Page 1 of 2

AngularTranslate tutorial

Posted: Thu Mar 24, 2016 11:40 pm
by Andrew Peacock

Hi team,
Is there any chance you could add a tutorial for AngularTranslate implementation, i the same way you've done i18next for JQ builds, please?

(Or some other Angular translation module, if not).

Regards,
Andy


AngularTranslate tutorial

Posted: Sun Mar 27, 2016 11:17 am
by Evgene Karachevtsev

Hello Andrew,

We passed your request to our development team and will get back to you with the update.


AngularTranslate tutorial

Posted: Tue Mar 29, 2016 9:22 am
by Andrew Peacock

Thanks Evgene.


AngularTranslate tutorial

Posted: Wed Mar 30, 2016 7:57 pm
by Illya Stepanov

Hi Andrew,

We have published a Development Tip in our blog, please check it out: https://blog.appery.io/2016/03/develo...


AngularTranslate tutorial

Posted: Wed Mar 30, 2016 8:14 pm
by Andrew Peacock

Thanks Illya, I just saw that! Appreciate the prompt and helpful support :-)

Andy


AngularTranslate tutorial

Posted: Wed Mar 30, 2016 8:52 pm
by Andrew Peacock

Hi
I'm almost there - if I use
$translateProvider.preferredLanguage('de');
or
$translateProvider.preferredLanguage('en');

the translation works. So thanks again for your tutorial.

But there's just one thing I'm stuck on - how to change the language dynamically.

I thought it would be:

code
var $translate = Apperyio.get('$translate');
$translate.use(languageCode);
/code

where languageCode is passed in as "en" or "de" in your tutorial. But that doesn't seem to do anything, even though $translate is defined, and can be logged to console as:

code
function (a,b,c,h,j){var m=j&&j!==i?L(j)j:i;if(angular&#46;isArray(a)){var n=function(a){for(var e={},f=[],g=function(a){var f=d&#46;defer(),g=function(b){e[a]=b,f&#46;resolve([a,b])};return R(a,b,c,h,j)&#46;then(g,g),f&#46;promise},i=0,k=a&#46;length;k>i;i++)f&#46;push(g(a));return d&#46;all(f)&#46;then(function(){return e})};return n(a)}var o=d&#46;defer();a&&(a=K&#46;apply(a));var p=function(){var a=e?I[e]:I[m];if(l=0,k&&!a){var b=f&#46;get(v);if(a=I,g&&g&#46;length){var c=J(g,b);l=0===c?1:0,J(g,e)<0&&g&#46;push(e)}}return a}();if(p){var q=function(){j(m=i),ca(a,b,c,h,m)&#46;then(o&#46;resolve,o&#46;reject)};q&#46;displayName="promiseResolved",p"finally"}else ca(a,b,c,h,m)&#46;then(o&#46;resolve,o&#46;reject);return o&#46;promise}/code

Any inspiration you can share?

Regards,
Andy


AngularTranslate tutorial

Posted: Wed Mar 30, 2016 8:55 pm
by Andrew Peacock

Ooh, I lied. I've just republished to make another change, and it's working. Bizarre.
Apologies for the confusion.

Great support from the team - pass on my regards to everyone concerned!

Regards,
Andy


AngularTranslate tutorial

Posted: Sun Apr 03, 2016 4:17 pm
by Mark Wong

Would you mind to tell me what solution did you use to solve the problem, I cannot change the language dynamically


AngularTranslate tutorial

Posted: Sun Apr 03, 2016 4:22 pm
by Andrew Peacock

I'm not sure, it just started working. I'll tease out the code later tonight and share here in case it helps.


AngularTranslate tutorial

Posted: Sun Apr 03, 2016 4:23 pm
by Mark Wong

Thank you, I tried your code:
code
var $translate = Apperyio&#46;get('$translate');
$translate&#46;use("de");/code
but somehow it doesn't work for me