Comparison of localization of meteors / i 18n libs

I am trying to evaluate which one to use, so rate any feedback from others who made this decision. There seem to be two large translation projects:

Messageformat

http://messageformat.meteor.com/

PROFI

  • based on MessageFormat.js containing lib
  • includes extraction tool
  • handles fuzzy lines and versions if lines are updated in the application
  • javascript and handlebars methods
  • translation tool / webUI for string translations http://messageformat.meteor.com/translate/af
  • written by Gadi, a meteorite guru, an active community guy.

Tap i18n

https://github.com/TAPevents/

notes:

  • based on i18next engine
  • uses AJAX to load languages

PROFI

MINUSES? - only JSON format, without yaml, so tedious to edit - no webUI for string management

There are other projects like https://github.com/Nemo64/meteor-translator but the two above seem to be the most thorough. Did I miss others?

What other criteria do people use when choosing the right tool? The core of messageFormat vs. technology i18next is a factor.

Questions:

1) Several languages ​​per page

I am trying to make a bilingual application, but:

Touch: "Only transactions for the current client language are sent by cable"

Does this mean that the language can only be A or B, but not a mix that is automatically switched based on the session?

that is, how to provide helpers on the page with multiple translations

EN: {{tr "string", 'en'}} FR: {{tr "string", 'fr'}} 

2) Extracting dynamic data

At least the messageFormat project will grab / retrieve strings on static pages, but if I have a lot of content already in complex mongo collections, is there any way to grab it?

Thank you for your understanding from the creators of the package or others in this area.

+5
source share
1 answer

Looks like you already decided.;)

how to provide helpers with multiple translations on a page

In MessageFormat you do not need to have special helpers for each language. You simply define your key and value once in your template for your base language - let them speak English. Then later, you can use the WebFormat to MessageFormat translation tool to add additional lines, such as French, Spanish, etc.

To select a language, you simply set the language standard so that you can add a drop-down list in your client so that it can be done by your user.

See SetLocale: http://messageformat.meteor.com/docs#methods

If I have a lot of content already in complex mango collections, is there any way to capture it?

I really need to learn a lot more about your application in order to answer how you could do this. MessageFormat simply creates a messageformat.js function file, so you can probably modify this file directly, but they will be overwritten the next time you run mf_extract. So I think you just need to get the name-value pairs defined in your application, for example {{mf 'admin.dashboard.title' 'Dashboard}}. But if you have a way to map the current “content” to these my keys, you can upload this content to the mfstrings collection or perhaps write code to output them to mfAll.js.,

We use MessageFormat for all our Meteor applications and love it. I have no experience with TAP i18n, but MessageFormat seems to satisfy our needs well (we do Japanese, English, Chinese).

I suggest just adding it to your project or using it with a test project to get some experience with it, then you can decide how you like it. Just make sure you read about mf_extract or get stuck.

+3
source

Source: https://habr.com/ru/post/1203172/


All Articles