angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Please add full featured i18n utility

Open fuqcool opened this issue 14 years ago • 30 comments

Current i18n support is too weak.

fuqcool avatar May 31 '12 04:05 fuqcool

Can you be more concrete?

Are you referring to supporting translation strings or something else?

IgorMinar avatar May 31 '12 09:05 IgorMinar

Yeah, I mean string translation. Currently, only filters can be localized, which is not enough for building multi-language sites.

Maybe a built-in $i18n service can be added?

fuqcool avatar Jun 01 '12 02:06 fuqcool

+1 over here, any recommended way of doing string translation ?

abourget avatar Jun 18 '12 19:06 abourget

I've seen these:

  • https://github.com/StephanHoyer/ng-translate
  • https://groups.google.com/forum/?fromgroups#!topic/angular/9C1F6PJ5KVY
  • https://github.com/Jehu/Angular-Addons

Any suggestion, or choice to be made ?

abourget avatar Jun 18 '12 19:06 abourget

It'd be a nice thing to have. However, translated resources files are usually big and we shouldn't push all the strings at once into users browser. At least not every language.

mariomelo avatar Sep 11 '12 19:09 mariomelo

Why is translating the views to different languages not sufficient?

mhevery avatar Sep 12 '12 06:09 mhevery

Hi Miško,

I think that rewriting all views for every language is less DRY than translating only the strings in each view. Without an option to translate strings, you'd have to replicate a layout change in every view you'd have.

I'm not sure if it should be always done in angularJS, but I think it's a nice fature to have. It's not critical, but it'd be nice to have.

mariomelo avatar Sep 12 '12 13:09 mariomelo

There should be a tool which would extract the strings from views and generate translations. We have such a tool internal at Google, I would assume that there would be something similar in open source software. In any case we consider that outside of the scope of angular for now. On Sep 12, 2012 6:08 AM, "Mário Melo" [email protected] wrote:

Hi Miško,

I think that rewriting all views for every language is less DRY than translating only the strings in each view. Without an option to translate strings, you'd have to replicate a layout change in every view you'd have.

I'm not sure if it should be always done in angularJS, but I think it's a nice fature to have. It's not critical, but it'd be nice to have.

— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/1003#issuecomment-8492817.

mhevery avatar Sep 12 '12 17:09 mhevery

I really need this, too. I just can't live without this after using Symfony translations.

elnur avatar Nov 17 '12 20:11 elnur

+1 here too. Keep up the good work ;-)

hsablonniere avatar Dec 04 '12 20:12 hsablonniere

Alternatively you can use requireJS i18n plugin to handle i18n strings. But ultimately I hope that Angular could have native support for i18n. +1 for this feature :-)

glassesmouse avatar Dec 11 '12 19:12 glassesmouse

+1 on string translation support. I am working on data entry forms for 56 science protocols, each of which needs translations for half a dozen languages.

tsenying avatar Dec 11 '12 21:12 tsenying

One of the improvments that could be implemented in AngularJS about translation of views is to translate view before putting it into templateCache and ten put translated version there.

This way we can avoid translation of same view multiple times when user navigates on it.

But I am not sure this could be done only by directives without modification of Angular....

olostan avatar Dec 12 '12 10:12 olostan

+1 for @olostan suggestion.

fitzchak avatar Jan 10 '13 17:01 fitzchak

+1 This is very important!

alantriesagain avatar Jan 27 '13 12:01 alantriesagain

+1 for full featured localization

wideblue avatar Feb 01 '13 10:02 wideblue

At work, our Java backend serves all template files with strings translated according to the current users preferred language. Text that needs translation are simply wrapped in square brackets. These are replaced by a specific servlet for that purpose. E.g. <span>[[ Some text to translate ]]</span>. The replacing is done by a simple regular expression.

Sometimes this is not enough, e.g. when receiving dynamic validation messages. In this case we have a simple REST service that return translations.

jafp avatar Feb 01 '13 14:02 jafp

i18next is a full featured javascript library/jquery plugin for internationalisation.

HusseinMorsy avatar Feb 12 '13 06:02 HusseinMorsy

Since I'm currently also need i18n in an angular app, I decided to develop a module which takes care of it. Notice: I didn't know the other implementations on the interwebs before publishing. Nevertheless, each module follows its own approach. Unfortunately non of'em really fits to my needs. So if you guys still interested in making i18n possible in angular apps, checkout this one:

ngTranslate

Feedback is very welcome!

0x-r4bbit avatar Apr 08 '13 20:04 0x-r4bbit

+1

I like the plugin i18n-js, very complete and efficient

peruzzo avatar Apr 18 '13 18:04 peruzzo