php-gettext / languages Goto Github PK
View Code? Open in Web Editor NEWgettext language list automatically generated from CLDR data
Home Page: https://php-gettext.github.io/Languages/
License: Other
gettext language list automatically generated from CLDR data
Home Page: https://php-gettext.github.io/Languages/
License: Other
Hello!
What determines the "Plural-Form" formula in PO translation files?
I see that the actual way is to use the same order the plural forms appear in this JSON file https://github.com/php-gettext/Languages/blob/master/src/cldr-data/supplemental/plurals.json , which, I suspect, comes from https://github.com/unicode-org/cldr/blob/main/common/supplemental/plurals.xml
Is it how it should be though? Is the CLDR data not just the source of grammar laws in different languages, but also determines the order of "Plural-Form" indices in the PO file format?
My inquiry is based on the problems of different plural form formulas existing for the same language (in my case – the Latvian language). More specifically, formulas with different order of the plural forms.
If we use numbers "1", "2", "0" to denote the three existing plural forms in Latvian (the first one contains "1", the second one contains "2", the third one contains "0"), then the two different formulas being used are
"1" => 0, "2" => 1, "0" => 2
"1" => 1, "2" => 2, "0" => 0.
Poedit switched between the two formulas on 2018-05-11 (my isssue about that).
The previously used format matched the English better: singular = 0, plural = 1, third case (zero) = 2.
And it would be fine if the CLDR had the zero case put as the last one, but they didn't (for whatever reasons).
For Latvian, it is now zero = 0, singular = 1, plural =2.
Which differs from the English and differs from a lot of translation files already made with the old formula. Which is still correct, from the grammar point of view. But the automatic CLDR data importing tools introduced a different order that crated problems because various PO file editors and readers/users didn't expect different formulas (different forms index orders) for the same language.
Hello,
Would it be possible to update to CLDR 37?
And GCC complains a warning: suggest parentheses around ‘&&’ within ‘||’
E.g.:
{
"name": "Romanian",
"formula": "(n == 1) ? 0 : ((n == 0 || n % 100 >= 2 && n % 100 <= 19) ? 1 : 2)",
}
Thanks a lot for this great module
Best wishes
Please support CLDR 33
Thanks a lot!
In your exported data for plurals, including the http://mlocati.github.io/cldr-to-gettext-plural-rules/ page, Russian (ru
locale) lists three plural forms: one
, few
, other
. However, if one looks at the original CLDR specs at http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Russian plural forms for integers are: one
, few
, many
. Is that a bug or some workaround you implemented in your converter?
For Debian packaging I am using #!/usr/bin/php
. But you may want #!/usr/bin/env php
instead, to be more generic.
CLDR 30:
<pluralRule count="one">i = 1 and v = 0 @integer 1</pluralRule>
<pluralRule count="few">v = 0 and i % 10 = 2..4 and i % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, …</pluralRule>
<pluralRule count="many">v = 0 and i != 1 and i % 10 = 0..1 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 12..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …</pluralRule>
<pluralRule count="other"> @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
On this page "pl" has only "one", "few" and "other":
http://mlocati.github.io/cldr-to-gettext-plural-rules/
Dear Michele,
Would it be possible to update this great package to CLDR-42?
Thank you so much for your efforts.
Best wishes from Vienna!
Hi,
Thanks for nice package.
I see that generated plural rules and categories are ignoring "many" for be,pl,uk locales.
Here is example of CLDR 44:
"pl": {
"pluralRule-count-one": "i = 1 and v = 0 @integer 1",
"pluralRule-count-few": "v = 0 and i % 10 = 2..4 and i % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, …",
"pluralRule-count-many": "v = 0 and i != 1 and i % 10 = 0..1 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 12..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …",
"pluralRule-count-other": " @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …"
},
output is just one, few, other which is not compatible.
Can you help me to fix it?
Thank you
Hello!
I am working on packaging this library for Fedora. Fedora packages often run test suites when possible, but I noticed that the release tarballs in this library do not seem to include the tests. Additionally, it would be nice to include the Readme file as documentation.
Thanks!
Hi!
I found out that the library returns 3 plural forms for the French language - https://php-gettext.github.io/Languages/ (http://i.imgur.com/8sjFFM6.png). This is a screenshot from my debug code - http://i.imgur.com/L4GEBXs.png
But other sources say that there are only two plural forms:
Could you please help me with this?
Thanks!
Dear Michele,
Is there a chance to upgrade this great package to CLDR-40?
Italian, Portuguese, and Spanish got a many
variant.
Thanks for all your efforts
Marcus
Hi!
I've created the php-gettext organization (https://github.com/php-gettext) and moved all packages related with gettext to there. The new version 5.0 also splits the whole repository in small packages (translator, scanner, etc), so developers can install only those features that really need.
Because this package is a dependency that uses the same vendor and namespace, I'm wonder if you're interested in move it to the organization, under the php-gettext/languages
repository. You would still be the maintainer. What do you think?
Please support CLDR 34
Thanks a lot!
Hi. I've added this package as a gettext/gettext dependency, as you can see in this branch: https://github.com/oscarotero/Gettext/tree/gettext-languages
The main benefit of this is do not reinvent the wheel. If this package can provide all information about plurals, it makes no sense that gettext/gettext does the same.
The main drawback is that there is now a dependency, so it's more difficult to install it without composer I think i'ts an acceptable drawback, but the autoloader.php file only load the gettext/gettext classes but not the gettext/languages classes, I guess this package can provide its own autoloader.php to use this code in any non-composer project:
require_once __DIR__.'/gettext/src/autoloader.php';
require_once __DIR__.'/cldr-to-gettext-plural-rules/src/autoloader.php';
Other issue that I found is the namespace. The vendor in composer is "gettext/languages" but the namespace is GettextLanguages
. I suggest to use the namespace Gettext\Languages
.
😄
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.