Closed sabsaxo closed 6 years ago
Well, that's good to know ; ).
But I seem to have issues following the README …
I have JSON files exported from localise.biz (plain key/value format), and no matter how I try to access them I always get:
oh nose No translation was found for msgid "Login" in msgctxt "" and domain "messages"
»oh nose« <- yes, copy/paste from the readme …
The translation object look like this (copied from the browser console):
Object { Login: "Ingresar", Password: "Contraseña", Register: "Registrarme", "Wrong-e-mail-or-password": "Dirección electrónica o contraseña incorrecta" }
And I try to access it using gt.gettext("Login").
I add translations like this:
gt.addTranslations( this.locale , 'messages', this.trans_file );
also tried:
gt.addTranslations( this.locale , 'messages', JSON.stringify( this.trans_file ) );
Where this.locale is a string like 'es', and this.trans_file is a JSON file imported like:
…
import es_trans from './translations/es_login_trans.json'; // the above output Object
…
But since the error states both 'msgid' and 'msgctxt' I suspect some formatting issue or missing setting(s) somewhere?
Any idea what I'm missing using this?
OK, and NOW (after posting) I notice your comments on »Migrating from v1 to v2« ... hm hm. Sorry 'bout that.
Unfortunately this only added to the total confusion : (
How do I simply:
?
This has taken me three days so far ... getting nowhere.
Maybe this will be helpful: https://github.com/LotusTM/Kotsu/blob/master/modules/gettext.js
In the Recipes section in the README, it says:
node-gettext
expects all translations to be in the format specified bygettext-parser
. Therefor, you should use that to parse .mo or .po files.
I'd say it's rather not.