Questions tagged [angular-translate]

Angular-translate is an AngularJS module including lazy loading and pluralization.

angular-translate is an AngularJS module that makes your life much easier when it comes to i18n and l10n including lazy loading and pluralization.

See,

714 questions
125
votes
5 answers

Correct use for angular-translate in controllers

I'm using angular-translate for i18n in an AngularJS application. For every application view, there is a dedicated controller. In the controllers below, I set the value to be shown as the page title. Code HTML

{{ pageTitle…

ndequeker
  • 7,336
  • 6
  • 54
  • 89
86
votes
8 answers

Get current language with angular-translate

Is there a way to get the current used language in a controller (without $translateProvider)? Couldn't find anything in the $translate service.
jviotti
  • 15,113
  • 22
  • 82
  • 134
51
votes
6 answers

Exposing the current state name with ui router

I'm trying to implement a language switcher where if a user clicks on "de" from any given page on an "en" side - it takes them to that page of the "de" side. If I console.dir the $state parameter, it exposes the values I'd want with the "current"…
motleydev
  • 3,007
  • 6
  • 26
  • 45
48
votes
2 answers

How to ng-translate inside select box option in angularjs

How do I apply ng-translate to translate options inside a select box. For example: Template: Controller: $scope.genders = [{code: "M",…
Rahul Prasad
  • 7,750
  • 8
  • 39
  • 49
26
votes
4 answers

Localize URL's with ui-router and angular-translate

I am using ui-router for routing and angular-translate for translations. What i would like to achieve is having the selected language bind to the url like…
Leon
  • 1,126
  • 1
  • 11
  • 16
23
votes
1 answer

How to best organize translation strings in angular-translate?

I am using angular-translate on a rather large Angular project. I am breaking the project into multiple modules to make it more manageable, but I am unable to break up my translation strings per module. For example, I have modules A and B, where B…
David Hansen
  • 2,148
  • 2
  • 16
  • 17
22
votes
1 answer

How can I switch languages dynamically with angular-translate and angular-ui-router?

My application is using angular-translate, angular-ui-router and templates. The application html pages with the exception of the index.html are packed into templates and served from Amazon CloudFront backed by S3. What I would like to do is to find…
Alan2
  • 19,668
  • 67
  • 204
  • 365
20
votes
4 answers

How to mock angular translate filter in unit tests for directives

In my directive templates, I need to use the angular translate filter as such: Then in my unit test for this directive,…
jokomo
  • 751
  • 2
  • 6
  • 9
18
votes
4 answers

Is there a way I can automate the creation of .json files used for language translations?

I have files such as this that have translation keys and values: locale-en.json { "CHANGE_PASSWORD": "Change Password", "CONFIRM_PASSWORD": "Confirm Password", "NEW_PASSWORD": "New Password" } locale-jp.json { "CHANGE_PASSWORD":…
user1943020
17
votes
2 answers

angular-translate sanitisation fails with UTF characters

On Angular 1.3.x with latest version of angular-translate. Using $sanitize it seems there are problems when using filter or service directly, but it works when using the directive. Suggestions? Here is an example: var myApp =…
fusio
  • 3,799
  • 5
  • 28
  • 44
16
votes
6 answers

Angular Translate HTML tags

I know this has been asked here before but none of the answers seem to work for my case I bought this theme Angle which is working with Angular 1.4.2 and Angular translate 2.6.0 (even updated to last 2.7.2) The template by default has the Translate…
Danny22
  • 1,876
  • 2
  • 28
  • 59
16
votes
2 answers

Internationalization of api error messages on front end or back end?

My team is currently working on a web project where the front end uses json api provided by the back end. The technology that we use is Spring Boot and AngularJS. The api has the standard error format that looks like this: { "errorCode":…
fkn
  • 419
  • 3
  • 7
16
votes
3 answers

angular-translate - Fallback language for determinePreferredLanguage()

I use angular-translate in my app. How can I register a fallback language if the determinePreferredLanguage() returns a language key my code doesn't know? I want to fall back to english if someone from e.g. Sweden visits my site (language key: sv).…
swenedo
  • 2,824
  • 5
  • 28
  • 46
14
votes
3 answers

Tool to organize translations in JSON files

I'm investigating different translation tools for my Angular app. So far, angular-translate seems to be a good solution for that. It uses per-language JSON files that are structured like "lang/NAMESPACE/LANG.json" (e.g. "lang/user/de.json") and look…
str
  • 33,096
  • 11
  • 88
  • 115
14
votes
2 answers

One-time binding with filter

I'll migrate my angularjs application from 1.2.0 to 1.3.0-rc2 and I want to change my code from bindonce to the new one-time binding.IS also used angular-translation. I write the follow code:
Abraham
  • 155
  • 1
  • 6
1
2 3
47 48