bugGNU gettext - Bugs: bug #59005, Can't translate strings properly...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #59005: Can't translate strings properly to Hebrew and Arabic

Submitter:  אורי <uri>
Submitted:  Mon 24 Aug 2020 12:07:19 PM UTC
 
Category:  Translator tools Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

Mon 18 Jan 2021 01:58:01 PM UTC, comment #2: 

Hi אורי,

The issue with % operator from python's str[1] is that unnamed parameters cannot be omitted in any case, therefore the limitation isn't on gettext because named identifiers do allow the omission of certain parameters, and they are currently implemented by msgfmt.  For example, the following code:

ngettext("%(number)d month", "%(number)d months", months) % { "number": months }

does indeed allow the following translation:

#, python-format
msgid "%(number)d month"
msgid_plural "%(number)d months"
msgstr[0] "one month"
msgstr[1] "%(number)d month"

And msgfmt --check-format implements checks for these cases too.

AFAIK[2], both Arabic and Hebrew have separate plural forms for the '1' case but plural forms on other languages may apply to more cases as explained by the manual[3].

This probably is certainly related to my lack of knowledge of Hebrew language: default Plural-Forms[2] is 'nplurals=2; plural=(n != 1);', is that an error from a native speaker POV?  From this wikipedia page[4] I guess that the dual case isn't common as it says "some count nouns" differ, therefore most of the plural and dual case translations would be the same.  Nonetheless, if your case requires it even when it isn't the common usage, you can modify the Plural-Forms accordingly too on your PO file.

[1] https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting
[2] https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
[3] https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html
[4] https://en.wikipedia.org/wiki/Modern_Hebrew_grammar#Number:_singular,_plural,_and_dual

Miguel Ángel Arruga Vivas <m1gu3l>
Project Member
Thu 27 Aug 2020 03:50:36 PM UTC, comment #1: 

This affects many other strings such as 2 years, 2 hours, 1 year, 1 hour etc.

אורי <uri>
Mon 24 Aug 2020 12:07:19 PM UTC, original submission:  

I can't translate strings such as "2 weeks" to Hebrew and Arabic properly. There is a word in Hebrew and a word in Arabic for 2 weeks, but I get an error message "`The expression '%d' is not present in the translation`" in Transifex and also `msgfmt -vc django.po` raises exceptions. In some languages, with some plural forms, such as `n == 1` or `n == 2`, we don't need `%d` to be present in the translation. Also "1 week" can be written in words "one week", also in Hebrew, and I think it's a better translation than "1 week". I also think English can use `"one week"` instead of `"%d week"` ("1 week", but in English, there is the issue of capital letters).

https://code.djangoproject.com/ticket/31937

אורי <uri>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by m1gu3l (Posted a comment)
  • -email is unavailable- added by uri (Submitted the item)
  • -email is unavailable- added by uri
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-08-24 uri Carbon-Copy- Added -email is unavailable-

    Back to the top


    Powered by Savane 3.9