Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Is there a getter for the registered available languages? #1304

Closed
ppollono opened this issue Nov 19, 2015 · 3 comments
Closed

Is there a getter for the registered available languages? #1304

ppollono opened this issue Nov 19, 2015 · 3 comments

Comments

@ppollono
Copy link

Hi,
I'm building an app which every time I need to do stuff with languages I'm making a request to my languages endpoint....

I'd like to register the available languages in the translate provider, and then use it instead of that request to my api/languages endpoint.

I couldn't find a way to get and use those registered languages in my controllers and directives, I'm mixing up stuff?

Thanks

@tspaeth
Copy link
Member

tspaeth commented Nov 21, 2015

Currently you can only retrieve the keys you put in via "registerAvailableLanguageKeys" from exactly the same function during configuration, but not from controllers. Right.
Why not storing this key-object in an application-wide constant if you're anyway putting them in from within your business logic (outside the module)?

@ppollono
Copy link
Author

Well I found 2 solutions for this:

  • Decorate the $translateProvider with a getter/setter of my appLanguages
  • Using constants.

Maybe will be a nice add to angular-translate since he is responsable of the internationalization of my app.

Thanks for the answer. 👍

tspaeth added a commit to tspaeth/angular-translate that referenced this issue Mar 3, 2016
…lable languages also from the $translate - service and not only in the configuration phase - closes angular-translate#1304
knalli pushed a commit that referenced this issue Mar 5, 2016
…lable languages also from the $translate - service and not only in the configuration phase - closes #1304
knalli pushed a commit that referenced this issue Mar 5, 2016
The getter returns the registered available languages.

Closes #1304
@knalli knalli added this to the 2.11.0 milestone Mar 5, 2016
@knalli knalli removed the waiting label Mar 5, 2016
@knalli
Copy link
Member

knalli commented Mar 5, 2016

Will be in 2.11

@knalli knalli closed this as completed Mar 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants