You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, there's any document about how it will work?
I'm wondering if I can write keys in markup and normal text in translation files like I'm using with angular-translate.
{{ 'HOMEPAGE__ACTION__SIGNUP' | translate }}
Coding like this, one external person can edit all supported languages (since they reside in JSON/po file, one file per language). If the main language is in the markup, it blocks all revisions until a developer can change the string in the markup code.
What do you mean by "binary per locale". Is the deployed resource file going to be binary little bit like PO/MO where MO is used insted of PO to improve performance. There are also bad examples in binary deployment such as XAML/BAML.
I am not very happy to the current Anguar localization methods. These are the reasons:
Several different APIs and methods.
You have to modify your templates so much from original that templates become hard to read and maintain.
You have to manually update the original resource file and make sure it is in sync with the IDs used in the template
What we really need is
One single official localization method with solid resource format (XML or JSON based)
Minimal affect to templates. For example only add "localize" attribute into root element and possible "noloc" attributes into those elements that are not localized.
Ability to add localization comments to the strings in the templates.
A tool that scans source code extracting orignal strings and comments into resource file. Use as permanent ids as possible. For example use id attributes or if such is not provided use combination of location and original string value.
This resource file should be able to store plain strings, strings with patterns ({{...}}), pluralized strings and gender strings little bit like Android's value files.
Easy way to package localized resources and to download them as needed
Ability to change language without reload.
I am ready to help if you guys need some help.
Reacted by D, Stéphane CHAN-KAM, Lazar Ljubenović, Anderson Tavares, Matmo10, Eric Swanson, linusbrolin, Heinrich Goebl and Ismael Ramos
@jaska45 most your wishes should come true. One exception: "Ability to change language without reload.". Changing a language will imply bootstrapping a new app.
Thanks. Sound very good. Language change is something that occurs seldom and in that case it is acceptable that some state is lost. Definetely lowest priority in my list and not worth spending too much efforts.
Reacted by Anderson Tavares, Falko, nhathongly and Ismael Ramos
@vicb I'm not sure if I understand this "binary per locale" correctly, but would that mean, that it's not possible to add translations at runtime? We are currently building SAAS with tenant support, where each tenant can extend our system by providing their own set of Form-Definitions and their own set of translations, so in our case it would be really important to be able to add translations at runtime.
@rayer4u this is not the subject of this issue, for support questions you should use stackoverflow or gitter.
I'll answer this one anyway, but don't ask further questions here that are unrelated to i18n future plans please.
The answer is: you can't do it, dynamic translations are not supported by Angular i18n since it works at compile or build time, and not at runtime.
@ocombe I Apologize for off Topic, no need to reply. I just have this need and can't find any quick way to discuss it. I think this may be concerned by angular i18n plan. As Angular i18n plan don't deal with interpolation, a extra mark/find/replace is better build time i18n solution for me right now. @martinmcwhorter Thanks for your reply. We write a lot mixed if/else logic to output diffrent i18n text in template, this is the easiest one. Maybe put runtime text logic in template is a bad choice.
No because we would have to maintain this when you edit the code.
Let's say that you have two blocks of i18n code that are the same, we add the ids, and then you change one of them, the ids don't match which means that the next extraction will skip on of those...
I confirm it's bad idea, can you explain how angular know to attribut same id to string when we extract again and again, how they keep same ID on string. so powerful but I don't undersand :s
Activity
thelgevold commentedon Jun 9, 2016
@vicb I have seen a few postings about i18n in the angular repo. How does this relate to https://github.com/angular/i18n? Is this a new initiative?
robwormald commentedon Jun 9, 2016
@thelgevold like most things in ng2, the standalone repos existed for early prototyping. major work is typically done inside of this one.
marcalj commentedon Jun 10, 2016
Hi, there's any document about how it will work?
I'm wondering if I can write keys in markup and normal text in translation files like I'm using with angular-translate.
{{ 'HOMEPAGE__ACTION__SIGNUP' | translate }}Coding like this, one external person can edit all supported languages (since they reside in JSON/po file, one file per language). If the main language is in the markup, it blocks all revisions until a developer can change the string in the markup code.
Thanks!
vicb commentedon Jun 10, 2016
@marcalj The (outdated) spec is https://docs.google.com/document/d/1mwyOFsAD-bPoXTk3Hthq0CAcGXCUw-BtTJMR4nGTY-0/edit.
Your use case is supported.
marcalj commentedon Jun 11, 2016
Thanks Victor! Any plans to include number abbreviations? It's something i18n context aware.
vicb commentedon Jun 16, 2016
@marcalj could you please create a separate issue with more details ? Thanks (but probably not for 2.0 anyways)
dagerber commentedon Jun 24, 2016
Is or will there be support for dynamic translations (loaded from a server)?
Any plans to document i18n in the near future?
Thanks!
vicb commentedon Jun 24, 2016
The current plan is to generate a binary per locale.
We will work on the doc as the features become available. We should definitely have a minimal doc for the 2.0 release.
jaska45 commentedon Jul 1, 2016
What do you mean by "binary per locale". Is the deployed resource file going to be binary little bit like PO/MO where MO is used insted of PO to improve performance. There are also bad examples in binary deployment such as XAML/BAML.
I am not very happy to the current Anguar localization methods. These are the reasons:
What we really need is
I am ready to help if you guys need some help.
vicb commentedon Jul 1, 2016
@jaska45 most your wishes should come true. One exception: "Ability to change language without reload.". Changing a language will imply bootstrapping a new app.
jaska45 commentedon Jul 1, 2016
Thanks. Sound very good. Language change is something that occurs seldom and in that case it is acceptable that some state is lost. Definetely lowest priority in my list and not worth spending too much efforts.
choeller commentedon Jul 4, 2016
@vicb I'm not sure if I understand this "binary per locale" correctly, but would that mean, that it's not possible to add translations at runtime? We are currently building SAAS with tenant support, where each tenant can extend our system by providing their own set of Form-Definitions and their own set of translations, so in our case it would be really important to be able to add translations at runtime.
101 remaining items
circle.yml
Create .cla%3A%20yes
ocombe commentedon Mar 16, 2017
@Thomas-Kuipers @thelgevold I'm working on it, and it will be available in 4.1 or 4.2 (most likely)
rayer4u commentedon Mar 21, 2017
@ocombe
how to deal with static text in interpolation, which can't use select translation.
string 'empty' can't be translate
ocombe commentedon Mar 21, 2017
@rayer4u this is not the subject of this issue, for support questions you should use stackoverflow or gitter.
I'll answer this one anyway, but don't ask further questions here that are unrelated to i18n future plans please.
The answer is: you can't do it, dynamic translations are not supported by Angular i18n since it works at compile or build time, and not at runtime.
martinmcwhorter commentedon Mar 21, 2017
Off Topic: I Apologize
@rayer4u The solution is to use static translations:
rayer4u commentedon Mar 22, 2017
@ocombe I Apologize for off Topic, no need to reply. I just have this need and can't find any quick way to discuss it. I think this may be concerned by angular i18n plan. As Angular i18n plan don't deal with interpolation, a extra mark/find/replace is better build time i18n solution for me right now.
@martinmcwhorter Thanks for your reply. We write a lot mixed if/else logic to output diffrent i18n text in template, this is the easiest one. Maybe put runtime text logic in template is a bad choice.
elvisbegovic commentedon Mar 29, 2017
maybe this is bad idea but can't angular add automatically
@@idin our i18n attributes when we extract first time ?ocombe commentedon Mar 29, 2017
No because we would have to maintain this when you edit the code.
Let's say that you have two blocks of i18n code that are the same, we add the ids, and then you change one of them, the ids don't match which means that the next extraction will skip on of those...
elvisbegovic commentedon Mar 29, 2017
I confirm it's bad idea, can you explain how angular know to attribut same id to string when we extract again and again, how they keep same ID on string. so powerful but I don't undersand :s
@ocombe
ocombe commentedon Mar 29, 2017
This is what we use: https://github.com/angular/angular/blob/master/packages/compiler/src/i18n/digest.ts#L13-L15
ocombe commentedon May 2, 2017
We are now at v4 so I'm closing this issue, please follow up in #16477 for our plans for v4 and beyond.
angular-automatic-lock-bot commentedon Sep 11, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.