-
Notifications
You must be signed in to change notification settings - Fork 154
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
Localization : feature? #107
Comments
I have the same problem. I have a little workarround Add this to your component to set the locale:
Not the best solution but it works for me. |
I solved this now by using the moment package directly and setting locale there. I will post a snippet in case anyone else needs it. But it would still be nice to have locales included in this module and functions for switching them.
4.a Remember to import the locale as described in the P.S
P.S.: If the locales doesn't work, you may need to include explicitly the locales you want to use. For me it's the case. It works when I debug but when I test on my real phone it doesn't work (just tested right now). Therefore import it like following (I'm not sure if its needed or not...):
|
For someone trying to use locales in ionic 2 app, I just included lang module as instructed by @Alx101 in app.module.ts after including angular2-moment like this and that automatically pulled spanish language
dp |
Thanks @davorpeic it woks in ionic2 but, how do I set the language dynamically? |
Thank you @Alx101 for your post. I want to add that this does not seem to work for me:
I ended up having multiple Moment instances (?) and the language was not properly set... This works for me:
I hope this helps some other people. @urish it would be nice if there were some info about localization in the ReadMe. |
@davorpeic your solution worked for me in angular2 app.... |
I'm also curious how to set the language dynamically? niether moment().locale('de'); or moment.locale('de'); worked for me but
so now, how do I change back to en if I want to? |
First, I import all available languages on my application:
Then, on my onLanguageChange() method:
|
@ramoncarreras awesome, but how would I make this work inside ngFor specific data with angular2-moment? |
Sorry @donking13, I can't help you with this. :( |
This worked for me: import { locale } from "moment";
locale('it'); |
Description of the Issue and Steps to Reproduce:
Did you search for duplicate issue? [Yes / No]
Please describe the issue and steps to reproduce, preferably with a code sample / plunker:
I guess this is more of a question than an issue, but I haven't found any info on this anywhere. Terribly sorry if this is the wrong place to post. But here goes:
Is there any way to localize the output of moment using this module? I know moment has the .locale() function, but I haven't gotten that to work, and I can't see any functions in this library where I could set the locale either. My goal is to allow for swedish translations as well as english, but I've had no luck. Any help would be very much appreciated.
Thank you
Ensure your issue is isolated to angular2-moment. Issues involving third party tools will be closed unless submitted by the tool's author/maintainer.
Environment:
Please answer the following questions:
moment
version? ^2.15.2moment-timezone
? noThe text was updated successfully, but these errors were encountered: