language mixup on traffic#6
Open
aymanc wants to merge 1 commit into
Open
Conversation
Ok so i noticed if i format a specific language in my handlebars, the change is then propagated to the rest of my node project
i made the following changes, and i hope this helps. i've noticed this module under a lot of different names although i posted it here for it being used under handlebars-helpers
Hope it helps,
Best, Ayman.
The changes are mentioned below
...
// moment.locale('en'); ---- So the thing is that:
// The changes you do in this helper via something like {{moment lang='fr'}}
// will affect your moment package settings being used in your project. if u're doing multilingual it's a problem
// You want to remove this and be dependant on the locale in your project whatever it may be.
// english being the default anyway
...
// set the language to use
// moment.locale(opts.lang); ---- Ok So The Same thing here.
// you want to use the locale setting option inside the moment() function instead for it to be a one time thing
if (opts.datejs === false) {
return moment(new Date(str), null, opts.lang).format(pattern); // As such
}
...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed if i format a specific language in my handlebars using the helpter-date, the change is then propagated to the rest of my node project through the moment library. Also, the languages get jumbled up within the helper when under considerable multilingual traffic.
I made the following changes, i've noticed this module is under a lot of different names although i posted it here for it being used under handlebars-helpers
Hope it helps,
The changes are mentioned below
...
// moment.locale('en'); ---- So the thing is that:
// The changes you do in this helper via something like {{moment lang='fr'}}
// will affect your moment package settings being used in your project. if u're doing multilingual it's a problem
// You want to remove this and be dependant on the locale in your project whatever it may be.
// english being the default anyway
...
// set the language to use
// moment.locale(opts.lang); ---- Ok So The Same thing here.
// you want to use the locale setting option inside the moment() function instead for it to be a one time thing
if (opts.datejs === false) {
return moment(new Date(str), null, opts.lang).format(pattern); // As such
}
...