Replies: 2 comments 1 reply
-
Currently, the programmer is expected to always provide only one message string, which is presumably arranged to be generally valid (in the lines of "%d file(s) deleted"). To maintain compatibility with other formats, the job of providing a second (perhaps conventional) string in What is important is to be able to distinguish between messages intended to be immutable and those intended to be 'pluraliseable'. A simple way to achieve this, which does not disrupt (too much?) the current economy of means of the Just my 0.02€... |
Beta Was this translation helpful? Give feedback.
-
I think I get what you mean. And |
Beta Was this translation helpful? Give feedback.
-
Sorry for the text wall, I think a bit of context is useful. While working on a tool to generate
.PO / .POT
files from Odin sources, I hit a difficulty..PO files contain two kinds of entries: the immutable entries, in which a single source language string is matched to a single target language string and the 'pluraliseable' entries in which TWO source language strings (one for the fallback singular and one for the fallback plural) are matched to n target language strings (where n is defined in the .PO header and depends upon the language; in C / C++ this amounts to the difference between calling
gettext()
and callingngettext()
). Most .PO tooling do not even allow to enter the n translations if there are not the TWO source strings.core:text/i18n
calls to the various forms of theget()
proc group only provide one parameter for the string to be translated, so there is no 'second string' to be collected in the .PO file for the fallback plural and to mark the entry as 'pluraliseable'.Additionally, an immutable string is not a singular string (as the
number
parameter defaulting to 1 may suggest), but a string which will have only one form, which linguistically may be singular ("Account created") or plural ("All temporary files have been deleted"), the point is that it will never change: thenumber
parameter is not simply defaultable, it is actually irrelevant.The main reason for the second string to be there is that, for strings which may have different number forms and in case the whole i18n / l10n machinery fails (a missing
.mo
file may be enough for this), there will be fallback strings to cover the plural possibilities, even if in the source language only (which, as a fallback, is assumed to have a simple one/many plural structure).In practice, for the moment being, I am resorting to rendering as .PO immutable entries the
get()
calls with no explicitnumber
parameter and as 'pluraliseable' those with an explicitnumber
parameter, conjuring out of thin air a second string like "ADD A PLURAL FORM HERE!", hoping the programmer (this is still programmer side) will go through the initial .POT file once generated, adding all the missing strings. This will allow the translator to add all the pluralisation forms he will need for the specific target language.Still, I am not convinced this is the way to go and that, sooner or later (better sooner than later), this distinction would/should rather be made at API level, introducing two families of
get()
calls, one with one text string and no number and one with TWO text strings AND the number.Comments and/or objections are welcome!
Beta Was this translation helpful? Give feedback.
All reactions