angular-translate

“10 $digets() iterations reached” when trying to $http.post() from ng-translate error handler

余生长醉 提交于 2019-12-24 11:35:28
问题 We're using angular translate to handle localization of a web site, using our own custom loader that fetches translations from the server. On the server side, we have logic that handles missing translation keys so that we both return something (a translation from a fallback language or the key itself) and reports to the system that the key was requested (so it shows up in the translation UI elsewhere on the site). Now, I'm struggling with building something similar on the client side. The

Force translation into certain language with angular-translate

左心房为你撑大大i 提交于 2019-12-24 04:24:16
问题 I have two translations for my app, English and German, but I need my invoicing module to use a separate language setting. Is there a way to force the labels on the invoicing page to use the language I set in the invoice_language variable? So instead of {{ 'TD_ID' | translate }} I need something like {{ 'TD_ID' | translate:'{"language": invoice_language}' }} 回答1: Bind your TD_ID only once in your controller swapping the language before you do so. In your view, instead of: {{ 'TD_ID' |

Angular translate: placeholder not showing special characters correctly

五迷三道 提交于 2019-12-23 17:21:38
问题 I am currently using angular-translate for a project, and it's going really well. However I run into a problem and I can't see why it's not working. I have an input field with a placeholder text, which has to be translated. This works fine, except when the translation-text includes special characters such as øæåüöä and so on. This is my code: <input type="text" ng-model="search.query" autofocus translate-attr-placeholder="SEARCHPLACEHOLDER" translate /> <div translate>SEARCHPLACEHOLDER</div>

Chaining Angular promise rejections

半腔热情 提交于 2019-12-20 07:18:34
问题 I have a chained promise and in the case of a rejection for either of the promises, I need to perform an async operation (get the translated error message). As I've already got a chained promise on success, I assume it's not possible to also chain on rejection - I am attempting to simply nest the async calls, but I'm not getting the resolved promise back from deferred.reject(deferredRejection.promise); below. Pointers appreciated! login: function(email, password) { var deferred = $q.defer();

How to mock angular translate filter in unit tests for directives

陌路散爱 提交于 2019-12-17 15:55:16
问题 In my directive templates, I need to use the angular translate filter as such: <label for="data-source-btn"> <span id="data-source-btn-span"></span> {{'Data Source' | translate}} </label> Then in my unit test for this directive, I get the error: Unknown provider: translateFilterProvider <- translateFilter I've tried injecting $filter and getting $translate by $translate = $filter('translate'); which doesn't solve the problem - this is really for testing the filter I can inject the module

angular-translate: filter ignores namespace

大兔子大兔子 提交于 2019-12-12 03:59:22
问题 I'm using angular-translate. And it seems that filter-based translation does not use translate-namespace defined with attribute-level directive above. AFAIK it's because filter cannot process scope chain. Is there a way to connect filter-based translation to namespaces? <div translate-namespace="form"> <translate>create-new</translate> <!-- this works respecting namespace --> </div> <div translate-namespace="list"> {{"create-new"| translate}} <!-- this doesn't use namespace at all --> </div>

Dynamic language selection in AngularJS

不想你离开。 提交于 2019-12-12 01:48:29
问题 Hi I am developing one application in Angularjs. This website will be in two languages. They are arabic and english. Belo is the logic i am using for selection of language. If the browser default language is Arabic then display website in Arabic. If the browser default language is not Arabic then display website in English. Also i have kept image(Arabic and English) on website to switch between languages. <div class="language"><a href="#"><img src="images/arabic.png"></a></div> <div class=

multiple configuration in AngularJS module

非 Y 不嫁゛ 提交于 2019-12-11 20:13:37
问题 I am using ng-route and ng-translate at the same time, where both require configuration in the module. Apparentely my routing is working but my ng-translate is haveing problems of being in the same confing with routing configuration. "use strict"; (function(){ var app = angular.module('ratingApp', ['ngRoute', 'ui.bootstrap', 'ngMessages', 'ngFileUpload', 'ngAnimate', 'pascalprecht.translate']); app.config(function($routeProvider, $translateProvider){ $routeProvider .when('/', { templateUrl:

White Blank Screen in Ionic on Arabic Translation

て烟熏妆下的殇ゞ 提交于 2019-12-11 19:16:10
问题 I am developing an Ionic app in which I am also using angular-translate lib. The app works in all views in English but when I switch to Arabic, on some views it work fine but on some of the views show a white blank screen after a blink of the original view with nothing in console. It is very strange when i click on inspect element, the view appears and there is a white flash when switching from one view to another. It only happens when I select Arabic as a language. It works fine in English

Angular Translate async timing issue with $translateProvider.useStaticFilesLoader

℡╲_俬逩灬. 提交于 2019-12-11 12:02:34
问题 I am using the excellent Angular Translate ( $translate ) directive/service to deal with multiple Locale Languages and since I have multiple locale files I use the convenient $translateProvider.useStaticFilesLoader to load my translation files through a structure of localeAbbr.json, for example en.json , es.json , etc... I built a Plunker to show my open source project and that project uses the locale through Git raw files (pointing to the actual Github repository, meaning not local to the