3 ms·
I created Localize.js (https://localizejs.com https://localizejs.com), a localization SaaS. Pluralization is a challenge, but we're able to solve this with som
by cj 12y ago
I created Localize.js (https://localizejs.com https://localizejs.com), a localization SaaS.
Pluralization is a challenge, but we're able to solve this with some pretty simple HTML tags.
For example:
<div>I have <var pluralize="3">3</var> dogs!</div>
Localize.js identifies the <var> tag with the pluralize attribute, and pluralizes the phrase to any language (including languages like Arabic which can have 6 different plural forms).
- julie1 12y agoYou don't solve the inflexion problem. You would need something where the lemmization tokenization of the sentence is easily accessible to a grammar engine. Something horrible like: <div ><lemm="personnal pronoun">I</lemm> <lemm=verb>have</lemm>< <case=accusative quant=3><lemm=noun quantifier /><lemm=....</div>
- cj 12y agoLemmatization isn't necessary in this case, as there's no need for a grammar engine. Here's how we handle pluralization on our backend (all abstracted away from the user): For a language with 2 plural forms (ie. French), we create 2 different phrases. One singular and one plural. Or for languages like Arabic, we create 6 different phrases for each plural form. We then send each plural form of the phrase to a human translator, who translates each phrase independently. This ensures proper plural forms for all variations, without the need for complicated grammar syntax.
- mfenniak 12y agoHuh. Localize.js sounds really cool. Fantastic idea. Can you explain your example a little more? What would translators see in this case for Arabic; would they need to provide three translations? And if there were two variables, nine translations? "Localization" also implies a lot more than just translation. Does Localize.js handle work like culture-specific number and date formatting? Different collation of records for different languages? How does it identify application-generated text versus user data (eg. on a blog, does it translate blog comments entered by readers, or just text like "Please enter a comment below")?
- cj 12y ago> What would translators see in this case for Arabic The Arabic translator would have to provide 6 different translations, one translation for each plural form. > And if there were two variables, nine translations? We currently only allow for pluralization based on one variable per phrase. We're hoping address this soon. > Does Localize.js handle work like culture-specific number and date formatting? We usually recommend libraries like moment.js to handle date localization. They do a fantastic job at localizing dates. > How does it identify application-generated text versus user data We provide a set of HTML markers that you can use to indicate to Localize.js that certain text should be translated. For example... <div class="blog-comments" notranslate> [...] </div> https://localizejs.com/docs/usage/variables https://localizejs.com/docs/usage/variables
- deleted 12y ago[deleted]