-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
Some improvements and retryInDefaultLocale option #206
Conversation
i18n.serializeLocale(localeObj) - convert object to string i18n.deserializeLocale(fileContent) - parse file content to object
Hi, If you don't mind, I'd take care of splitting and merging in a separated feature-branch or you could submit 4 PRs instead of one big one. Now, some words concerning each of those features:
So all in all I had to battle with my fingers not to click on "merge pull request" - but for now I have to focus on that get|setLocale/register config option. You might leave that PR open and I'll split it or you might close and send separated PRs. Thank you very much in either way :) |
Well explained, thanks.
I add test for serialization and add message if mustaches modules is missing. Will it be easier for you just take parts parts that you like and improve if needed? |
@mashpie is there a plan to release 0.9.0 ? |
When its done :) will be in weeks Von meinem iPhone gesendet
|
Note that as currently implemented this will cause infinite recursion for non-existent messages, because the accessor() check will just keep failing. I've implemented a naive improvement here: |
Any news on that? Would love to have the retryOnDefaultFallback feature in production |
Waiting for this |
Hey @Paxa as written earlier it is hard to merge multiple features in at once, so I decided to take your proposals and review & implement them one-by-one. So this started today with the famous long wanted
Others will follow in separate releases. Thanks again for your work! |
Make Mustache as optional dependency
It will require
mustache
only if your key has{{}}
in it, you can override rendering method viai18n._renderMustach(msg, namedValues)
Related: #113
Move all options in i18n.options, make it accessible from outside
I know some people like to keep things in private variables (What for? idk), but I hate when I need to fork library just to change some little thing inside. With this changes you can read/write options one by one.
Expose API to override serialization:
I often put tailing coma in locale file and it gets revamped, with this I can set it in JS:
This feature will let you change format of locale file, it can be anything: yaml, js, properties, xml...
Related: #79 #73
Retry with
retryInDefaultLocale
optionWith it's on, i18n will use default locale if can't find translation in current locale. I'm planing to use it in production. If I forget to add some translation - I prefer to see english words in production instead of
section.something.like.this
P.S. I don't insist to merge it, but can be useful for other people