Page MenuHomePhabricator

New LanguageOs class
Closed, ResolvedPublic

Description

Author: bourons

Description:
LanguageOs class

Please add new LanguageOs class to the directory http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/classes/. LanguageOs.php is attached.

In the class case rules and plural forms for Ossetic language are described.


Version: unspecified
Severity: enhancement

attachment LanguageOs.php ignored as obsolete

Details

Reference
bz30846

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:52 PM
bzimport set Reference to bz30846.
bzimport added a subscriber: Unknown Object (MLST).

This file contains some errors, e.g. "genetive" instead of "genitive". Have you tested it?

bourons wrote:

I have tested it on my personal wiki for tests (http://alaninternet.org/w/index.php?uselang=en&title=LanguageOs_test&action=edit). It works.

About "genitive". I am attaching corrected version.

bourons wrote:

LanguageOs class

Corrected. "genetive" => "genitive"

attachment LanguageOs.php ignored as obsolete

I don't like the looks of the way regex is being abused. From the looks of it you should be using a proper regex with a character class rather than trying to concatenate user input into a regex pattern.

Why is there convertPlural that re-implements the default implementation?

bourons wrote:

LanguageOs class

Corrected

attachment LanguageOs.php ignored as obsolete

bourons wrote:

(In reply to comment #4)

I don't like the looks of the way regex is being abused. From the looks of it
you should be using a proper regex with a character class rather than trying to
concatenate user input into a regex pattern.

I have attached corrected version.

bourons wrote:

(In reply to comment #5)

Why is there convertPlural that re-implements the default implementation?

I didn't know that there is the default rule.

But I still think we should implement convertPlural for Ossetic. It is clear using form0 for n=1 and form1 for n>1 in literature dialect. But using form1 for n=0 is not clear in literature. So it would be better for finding best form for Ossetic if someone see unclear rule in class LanguageOs instead of searching it in class Language. But if it is necessary I won't mind deleting convertPlural function.

bourons wrote:

LanguageOs class

ирон æвзаг(ossetian language) => Ирон (Ossetian)
Changed convertPlural() as in Language.php

attachment LanguageOs.php ignored as obsolete

bourons wrote:

LanguageOs class

Sorry for my bad PHP skills. Correcting some mistakes. Adding new case rule for words in plural form.

attachment LanguageOs.php ignored as obsolete

bourons wrote:

LanguageOs class

Deleted convertPlural

attachment LanguageOs.php ignored as obsolete

bourons wrote:

Question to maintainers. Is there any other problems with the class? And have I solved problems you pointed out?

This class is very important for translating MediaWiki. It is impossible to put {{SITENAME}} into right form with help of wiki mark up. Everything depends on the last two letters of the word. So it can be solved only with {{grammar:case|word}}.

Looks fine to me. Will handle on Monday.

bourons wrote:

LanguageOs class

Style changes: "'" => "-".

attachment LanguageOs.php ignored as obsolete

Why is this twice?:
if (preg_match('/тæ$/u', $word)) $word=mb_substr($word,0,-1);

What does this do? Can you add a comment with example or something?
elseif ( preg_match( "/[у]/u", $ll) ) {

if ( !preg_match( "/[аæеёиоыэюя]/u", mb_substr( $word, -2, 1 )) )

Can you also do with out $ll variable? It is easy to match the end of string with pattern like /y$/.

It also does not follow our coding conventions, but that is something I can fix when I commit.

bourons wrote:

LanguageOs class

Per comment 15. Updated conversion to allative.

Attached:

bourons wrote:

(In reply to comment #15)

Why is this twice?:
if (preg_match('/тæ$/u', $word)) $word=mb_substr($word,0,-1);

What does this do? Can you add a comment with example or something?
elseif ( preg_match( "/[у]/u", $ll) ) {

if ( !preg_match( "/[аæеёиоыэюя]/u", mb_substr( $word, -2, 1 )) )

Can you also do with out $ll variable? It is easy to match the end of string
with pattern like /y$/.

It also does not follow our coding conventions, but that is something I can fix
when I commit.

Done.
Letter 'у' can be either vowel or consonant. So it is important to specify it for putting 'й' between word and case ending.
This is an example: {{grammar:genitive|аунеу}} = аунеуы, {{grammar:genitive|лæппу}} = лæппуйы.

Committed with style changes in r97515.