New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it so that it's easier to load translations dynamically #60
Comments
As it is now, to work around it I have to do: import y18n from 'y18n';
const instance = y18n({updateFiles: false});
instance.setLocale('language');
instance.cache['language'] = {};
const translation = instance.__('translate this!'); |
diamondap
added a commit
to APTrust/dart
that referenced
this issue
Apr 13, 2022
y18n language fallback does not work. In fact, the fallback code in commit yargs/y18n@bf1ef9b seems to have been deleted from the y18n repo. Calling setLocale() also does not load the proper locale file, as advertised in yargs/y18n#60. So we're rolling our own.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wrote a static parser for webpack that reads the source files and uses y18n to generate the json file. But cache isn't part of the public api and there is no way to keep readFile from being called in a browser. Is there any way to make this more flexible?
https://github.com/zakkudo/translation-static-analyzer
https://github.com/zakkudo/translate-webpack-plugin
I plan on making npm packages by next week for this, which will be a bit easier to test with....
The text was updated successfully, but these errors were encountered: