-
Notifications
You must be signed in to change notification settings - Fork 279
Localize moment, timeAgo, ... #678
Comments
Yes, basically we've ended up with a solution that I was recommending against but hidden in a third-party code and slightly more robust. And yes, we'd need to dynamically load the moment locale and then call I won't argue against it since it's apparently the only way to go if we don't want to include all locales in the bundle. |
Is there any “standard“ way to do this (load JS dynamically)? I did some searching, but couldn't find a package or angular command to do it. Except jQuery, which might be overkill? I had a function to do it, basically copied from jQuery. But an externally maintained command might be favourable, I guess? |
https://www.npmjs.com/package/oclazyload looks pretty nice on first sight and has good documentation. (Of course, as with most angularjs libraries, it's no longer maintained and has a lot of issues open but it might be just fine for our use case). |
Or could we modify this line to merge (i.e. append) the contents of the moment locales into the file of the angular locales? Line 102 in 1f5f541
That way we could rely on the single one mechanism (from dynamic angular locales) to load scripts dynamically. And we just needed to call TileBoard/scripts/controllers/main.js Line 17 in 1f5f541
|
That sounded like a good idea. I've looked into it to see if that will work and ended up implementing it in #680. |
* fix(locales): make moment follow the locale set in the config Resolves #678 * better order
Now since there is an option
locale
, this option should also apply to usages ofmoment
, for example in history graphs or intimeAgo
. Because, now, locales are not 100% consistent.However, I still don't have an idea, how to "properly" solve this. Apparently, we simply need to load the locale file, but I was advised against that, previously. Checking with angular's dynamic locale, they seem to do this, too. Just in a 3rd-party package.
The text was updated successfully, but these errors were encountered: