-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message uniqueness #48
Comments
Another problem is with |
I see. I'm not agree with this behaviour, but the library should be compatible with gettext (as its name says) so this change is necessary, but this affects to different things:
//Search only by context + msgid
$t = $translations->find(null, 'comment');
//Search by context + msgid + other non-unique parameters
$t = $translations->find(null, 'comment', array(
'plural' => 'comments',
'translation' => 'comentario',
'plural_translation' => 'comentarios'
)); |
I did a test with these two files (I don't write here the headers to be more clear): msgid "1 child"
msgstr ""
msgid "1 child"
msgid_plural "2 children"
msgstr[0] ""
msgstr[1] "" Running #, fuzzy
msgid "1 child"
msgstr ""
"#-#-#-#-# singular.po #-#-#-#-#\n"
"#-#-#-#-# plural.po #-#-#-#-#\n" Running #, fuzzy
msgid "1 child"
msgid_plural "2 children"
msgstr[0] ""
"#-#-#-#-# plural.po #-#-#-#-#\n"
"#-#-#-#-# singular.po #-#-#-#-#\n"
msgstr[1] "#-#-#-#-# plural.po #-#-#-#-#\n" The
The problem is that in gettext files we may have entries that are univocally identified only by context+msgid. |
So if we have two po files like: #: singular.po
msgid "1 child"
msgstr "1 fillo" #: plural.po
msgid "1 child"
msgid_plural "2 children"
msgstr[0] "1 fillo"
msgstr[1] "2 fillos" And we merge them, as they have the same id, they wont merged $singular->mergeWith($plural); //this has not effect
$plural->mergeWith($singular); //this neither |
Yes, I tend to agree... With one exception: |
Ok, I'm agree. |
In the commit f9d1854 I've made the following changes:
So this allows scan multiple files with duplicated entries or even a po file with duplicated values with no problems, merged silently the duplicated values. |
Great! IMHO, since you added some breaking change, the next gettext version should be a major (2.x) release (see semver rules). |
I was thinking in 2.4 but maybe you're right and 3.0 is better. |
As you guessed, I meant |
done |
Let's say we have a
test.po
file like this:If we compile it with
msgfmt
we have:So, we may not have in .po files two strings with same context+msgid but different plurals.
I think that we should apply two changes:
Translations::find
that does not take in account the plural formThe text was updated successfully, but these errors were encountered: