WordPress.org

GlotPress

Opened 7 years ago

Closed 6 years ago

Last modified 3 years ago

#135 closed defect (fixed)

plurals value for Serbian triggers an error in poEdit

Reported by: beaulebens Owned by: somebody
Milestone: 1.0 Priority: normal
Version: Component: General
Keywords: Cc: nbachiyski

Description

When a .po file is exported from a Serbian project (e.g. http://translate.wordpress.com/projects/gravatar/sr/default ) and then opened in poEdit, an error is triggered upon save.

18:25:46: /Users/beau/Desktop/grav-trans/sr.po:4: invalid plural expression
18:25:46: /Applications/Poedit.app/Contents/MacOS/msgfmt: found 1 fatal error

The plurals value included in the .po file is:

nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 or n%100>=20) ? 1 : 2);

changing it to this allows you to save the file successfully:

nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;

The modified value was taken from this page: http://drupal.org/node/17564

Change History (5)

#1 @nacin
6 years ago

The difference appears to be a set of parentheses around the entire plural expression. I cannot find a spec, but they are omitted from http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html.

Quite a few locales follow this same pattern in locales.php, though it is not consistent. Here are the ones that would need to be updated:

203:		$be->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)';
267:		$br->plural_expression = '(n > 1)';
278:		$bs->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)';
765:		$hr->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)';
833:		$is->plural_expression = '(n % 100 != 1 && n % 100 != 21 && n % 100 != 31 && n % 100 != 41 && n % 100 != 51 && n % 100 != 61 && n % 100 != 71 && n % 100 != 81 && n % 100 != 91)';
995:		$lt->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)';
1007:		$lv->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)';
1209:		$pl->plural_expression = '(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)';
1222:		$pt_br->plural_expression = '(n > 1)';
1265:		$ru->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)';
1277:		$ru_ua->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)';
1289:		$rue->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)';		
1362:		$sl->plural_expression = '(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)';
1395:		$sr->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 or n%100>=20) ? 1 : 2)';
1508:		$tr->plural_expression = '(n > 1)';
1538:		$uk->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)';

#2 @nacin
6 years ago

Tested this. Realized I was off and missed the other, more obvious difference.

#3 @nacin
6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [683]) Correct the Serbian plural expression. ||, not 'or'. fixes #135.

#4 @nbachiyski
6 years ago

  • Cc nbachiyski added

#5 @markoheijnen
3 years ago

  • Milestone set to 1.0

Marked all fixed tickets solved on milestone 1.0

Note: See TracTickets for help on using tickets.