Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
MMXII Posted November 10, 2019 Posted November 10, 2019 Short question: Can I add custom pluralization in language strings? If so, how? Example: (Yes, I am not talking about the following language string specifically - this is a general question) A language string says "%s has posted %s". Can I change it to "{# [1:A person has][?:Many people have]} posted %s"? Can this be done with any language string that just has "%s" in it, or does it require more? I did not find anything regarding this in the help section or I did not understand pluralization correctly. 🙂
Daniel F Posted November 10, 2019 Posted November 10, 2019 35 minutes ago, MMXII said: Can this be done with any language string that just has "%s" no 35 minutes ago, MMXII said: or does it require more? yes Pluralisation has to be called inside the template or php code and next to the language string you also need to pass the "number" which will be used to determine what to return. See also and
MMXII Posted November 10, 2019 Author Posted November 10, 2019 28 minutes ago, Daniel F said: Pluralisation has to be called inside the template or php code and next to the language string you also need to pass the "number" which will be used to determine what to return. I see. So I have found quite a few language strings that need pluralization, but as of now they do only offer "%s", which unfortunately is not enough to work with. Should I report each and every one of them as a bug? Or what is the best way to continue from here on? Also, while having the next major release (version 5) in mind, please allow me to ask the following questions: Will translations and how they are handled get more attention? Will you consider improvements to the current way language strings are being used? Right now there are some serious issues to create good (precise) translations when it comes to languages other than English. (It is not really needed to answer these questions as I think you do not want to talk about v5 at this time. I would be happy though if translations were receiving more attention in the near future.)
Meddysong Posted November 10, 2019 Posted November 10, 2019 It should be the case in a sentence like where you want something like this that %s refers to a string like "Bob Smith" or "Bob Smith, Tom Jones and x others". You shouldn't need to make such a change anyway. If one is missing, you can just report it.
Sonya* Posted November 11, 2019 Posted November 11, 2019 21 hours ago, MMXII said: Should I report each and every one of them as a bug? Or what is the best way to continue from here on? I am also interested of how to give feedback on it. Actually I have "unpluralized" string x_records_in_this_category in Pages. Where should I report it? In support ticket or in feedback forum?
Daniel F Posted November 11, 2019 Posted November 11, 2019 6 minutes ago, Sonya* said: x_records_in_this_category This is already pluralised. I've also just tested it and can confirm that it works.
Sonya* Posted November 11, 2019 Posted November 11, 2019 @Daniel F the English translation is %d %s in this category. How do I apply this to the phrase? {# [1:record][?:records]} in this category We need more than one plural form. EDIT: Sorry, I see it is not possible as the language strings from the database are used here
Recommended Posts
Archived
This topic is now archived and is closed to further replies.