-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Feature: Parent and ignore files #118
Comments
@stewieoO If I understand correctly you are looking for some sort of "ignore key pattern", did I understand correctly? |
@shaharkazaz exactly. |
@stewieoO You are welcome to implement this feature 🙂 I can't say when this might be implemented. |
@shaharkazaz Right, that's all i wanted to know really. |
@stewieoO Just to make sure we understand each other, I'm talking about providing a regex/string pattern in the manager's config that when matched the key is ignored by the extractor/detective. |
@shaharkazaz oh, no. I'm talking about providing paths to files that are structured just like the translation files. ignore.json {
"labels": {
"name" : "anything",
"profile" : null
}
} Which would result in keys with the same path (labels.name, labels.profile) would not be extracted and written to the corresponding translation files. |
What's the advantage of providing a file over a regex? seems less flexible and more repetitive. What do you mean by:
|
@shaharkazaz As i explained in the initial comment, i want to merge translations when the app is loading them
I can prepare a full example repo (with ngx-translate currently ofc) to demonstrate my usecase if desired. |
@stewieoO can you make a small reproduction of your use case with Transloco? |
@shaharkazaz i'll do that yeah. |
https://github.com/stewieoO/transloco-whitelist-example The
The If i would run the extractor over this example, it would write the |
@stewieoO It's been some time, I hope you managed to resolve your issues already. I don't fully understand you issue, but maybe you could write custom transloco transpiler that would first try to get translation from lang file and then fallback to the defaults file. That way you could keep files separated without the need for changes in extractor. @shaharkazaz So while looking for a solution I found your comment here and it sounds like something that would work for me. I'd be happy to make PR for it, but no sooner than in 2-3months. For now I could make new issue with more detailed description to keep track of it as a feature. |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe
So i have an idea but i'm not sure if it's something that is generally desired.
I am currently using ngx-translate and considering a migration to transloco.
However i am missing one feature that is very important to me.
I have my own angular framework with modules and all that neat stuff i reuse in multiple projects.
In that framework i have a default translation file for common resources. (e.g. 'labels.save' -> Save button).
In my project i use a custom translation loader that merges those default files with the loaded language.
CustomTranslationLoader Gist
I made a fork of ngx-translate-extract that takes a path for those default files and an ignore file.
Extract Task
Is that something worth adding to the main repo?
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Describe alternatives you've considered
Describe alternatives you've considered
Option to provide a parent and ignore file to remove found keys before writing them to the translation file as seen here
Additional context
No response
I would like to make a pull request for this feature
No
The text was updated successfully, but these errors were encountered: