Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i18n] ng insert-i18n (reverse ng extract-i18n) #55073

Open
pfeileon opened this issue Mar 27, 2024 · 7 comments
Open

[i18n] ng insert-i18n (reverse ng extract-i18n) #55073

pfeileon opened this issue Mar 27, 2024 · 7 comments

Comments

@pfeileon
Copy link

Which @angular/* package(s) are relevant/related to the feature request?

localize

Description

There is a barrier for using Angular's i18n solution because eventually the source code and source language file will differ and to keep them in sync the source code needs to be manually updated which means a developer has to spend time on an automatable task.

If the process was two-way, the i18n package would be way more useful; and not only for its core intent but also for simply maintaining the text content of an app.

Proposed solution

Ideally the cli supports a command to write the strings from the extracted source language file back into the source code.

ng insert-i18n

Alternatives considered

Right now the differences between language file and source code need to be cleaned up manually or by writing a custom automation script. Both alternatives are imho dealbreakers and made me implement a custom way to deal with i18n every single time.

@ngbot ngbot bot added this to the needsTriage milestone Mar 28, 2024
@nkosi23
Copy link

nkosi23 commented Mar 30, 2024

Is the below what you are looking for?

https://github.com/daniel-sc/ng-extract-i18n-merge

I agree that it should be included in the core i18n library, because i fail to see how the i18n can be useful for real projects without such a tool

@pfeileon
Copy link
Author

Is the below what you are looking for?

https://github.com/daniel-sc/ng-extract-i18n-merge

I agree that it should be included in the core i18n library, because i fail to see how the i18n can be useful for real projects without such a tool

No, from my understanding this does not include my requested feature. It's about updating the source language file from the source code but still only one way. If you want this functionality it's a separate feature request.

@nkosi23
Copy link

nkosi23 commented Mar 30, 2024

Is the below what you are looking for?
https://github.com/daniel-sc/ng-extract-i18n-merge
I agree that it should be included in the core i18n library, because i fail to see how the i18n can be useful for real projects without such a tool

No, from my understanding this does not include my requested feature. It's about updating the source language file from the source code but still only one way. If you want this functionality it's a separate feature request.

I was just trying to help, not trying to hijack your thread. All right, at least it helped clarified what you are after as other people are likely to misinterpret your request like as i did.

For this is quite an unusual request, you may want to clarify your use case and give examples of other tools achieving what you are after to increase your chances of getting an answer from someone who can help. I've written a couple of localization tools but can't remember coming across such a feature, nor feeling that I needed it

I am not saying this to dismiss your use case, just to highlight that it may feel weird to other people that you'd need something like that, that's why I assumed that you were approaching your problem from the wrong angle and actually needed the extract-merge library.

@spock123
Copy link

spock123 commented Apr 3, 2024

I also ended up writing my own script, because extract only creates new translation files but cannot update existing. So once run 1. time, it's game over basically.

@nkosi23
Copy link

nkosi23 commented Apr 3, 2024

I also ended up writing my own script, because extract only creates new translation files but cannot update existing. So once run 1. time, it's game over basically.

This is not what he is requesting apparently,for this use case you can use the library i posted above.

@spock123
Copy link

spock123 commented Apr 3, 2024

@nkosi23 you're right, it's not the precise same use case.

I did try out that library but it didn't really work as I had hoped, so had to make my own.

@pfeileon
Copy link
Author

pfeileon commented Apr 3, 2024

I guess what I'm requesting is the reverse operation of how extract-i18n should work.

I'm not sure if this feature request should include expanding the functionality of the original cli command, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants