i18next / i18nextify

enables localization of any page with zero effort.
MIT License
61 stars 21 forks source link

Does i18nextify support saveMissing? #80

Closed cielito-lindo-productions closed 7 years ago

cielito-lindo-productions commented 7 years ago

Hi,

first of all thanks for all your great work.

I'm actually trying i18nextify out and would like to save missing translations in the file structure on my webserver (apache). For this I set debug and saveMissing to true.

This is the code I use

`

` The console in the debugger shows the following: `i18next::backendConnector: loaded namespace translation for language de Object { Flexible connection to: "Flexible Verbindung zu " } i18nextify.min.js:1:18859 i18next::backendConnector: loaded namespace translation for language en Object { Flexible connection to: "Flexible connection to " } i18nextify.min.js:1:18859 i18next: languageChanged de i18nextify.min.js:1:18859 i18next: initialized Object { debug: true, initImmediate: true, ns: Array[1], defaultNS: "translation", fallbackLng: Array[1], fallbackNS: false, whitelist: false, nonExplicitWhitelist: false, load: "all", preload: false, 34 more… }` I have the folder locals on my webspace and within a folder de and a folder en. Each of them has a file translation.json and translation.missing.json The translations from translation.json are read correctly by i18nextify but the other file is not filled up with the missing translations. Some days ago I tried starting my homepage from within node.js (as in the example) and there the translation.missing.json was filled up properly. Am I missing something? Greetings Cielito Lindo Productions
jamuhl commented 7 years ago

hm...saveMissing should be all needed to let i18nextify send missing keys via xhr-backend to your backend route. -> you should see the missing calls in your developer console of your browser

does your backend provide a route for those POST requests to addPath?!? https://github.com/i18next/i18next-xhr-backend#backend-options

This really should work - we use that commercial in our i18next service tier -> https://locize.com

jamuhl commented 7 years ago

The sample has that route https://github.com/i18next/i18nextify/blob/master/example/server.js#L33

using a saveMissingHandler from the express-middleware we created for i18next

with functionality: https://github.com/i18next/i18next-express-middleware/blob/master/src/index.js#L100

cielito-lindo-productions commented 7 years ago

Thanks for your comments. Can I use the saveMissingHandler within i18nextify? I don't use the express-middleware.

I tried to add the addPath-command but without success. I even created the files at the indicated places but without success:

`

` At least in the console i18nextify now states all the missing resources: `i18next: missing resources: { "en": { "translation": { [...`
cielito-lindo-productions commented 7 years ago

Formating somehow doesn't work. Please check https://jsfiddle.net/ue3b8ukt/ for correct formating

jamuhl commented 7 years ago

saveMissingHandler is serverside - no way that can run on the client - only thing you get on loading with fallback language is an output in console for the missings which you could copy over to your file manually - else try using locizify and https://locize.com supports the future of i18next i18n ecosystem and offers you a nice UI for translations (incontext editor and and and) ;)

what formatting? you fiddle is wrong: see https://jsfiddle.net/c9kaqbjv/

cielito-lindo-productions commented 7 years ago

Thanks for the explanation, that was a misunderstanding on my side.

With formatting I meant my above post in which the code is without line breaks.

jamuhl commented 7 years ago

so we could close this...?

cielito-lindo-productions commented 7 years ago

yes, you can go ahead and close it, thanks.