-
-
Notifications
You must be signed in to change notification settings - Fork 49
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: marker fn supports scope #132
Comments
@Alegiter I'm not sure I fully understand what you mean here. can you please share an example? |
I was looking for this too... i am pretty sure he means he would like a way to use the marker function to scope the translation key and extract it into the scope-file (like marker( test1, admin ) -> creates the key in the admin-scope file)... right now when I use the marker function I can only put the keys in the top-level translation file, right? (at least I haven't found a way to do it otherwise) |
@FloNeu, yes, it's exactly what I meant :) |
Any workaround to achieve this? |
Not an automatic solution as far as I have seen - I thought of generating the key-files for code into a master.json instead of the language-file directly and mark my translations with a 'prefix.' Like when the template keys use a scope and then separate them manually. Of course, this loses some advantages of the automatic extraction - but you can later run the find-method against the master and identify missing/extra keys that way again. But I thought it couldn't be too difficult to add this - as the extractor already looks for scope properties when taking keys from classes/templates. But I had no time to look into it yet. What would be the best way to implement it for keys from code - as we said before an optional 2nd string property on the marker-method - or just prefixing it? What does @shaharkazaz think on the matter - seems there is some interest in adding this feature. |
The only thing missing are the typings. |
can you explain how you got that to work? i tried this with disabling
typechecking on method call you showed, but translations weren't but in
their own file based on scope parameter
Am Di., 9. Aug. 2022 um 15:50 Uhr schrieb Christoph Bühler <
***@***.***>:
… The only thing missing are the typings. marker('username', {}, 'scope')
already works!
—
Reply to this email directly, view it on GitHub
<#132 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKPZ6AI6GQVU6FM4RTPS6LVYJO2TANCNFSM5UOPQD5A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This solution works for me without any issues. Add this to the paths of your tsconfig: The contents of
Then use the marker like this:
|
@christophbuehler Thanks for sharing! |
Is it possible to enable this typing? I would like to be able to pass the language / scope I think it will be difficult to add behavior here as in the comments in the template so that the scope is taken from the directive |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe
There are situations when I can't use template translation. Also I need to use translation from one scope in other place. Translation API is good than used in one place. But I need little more flex.
Describe the solution you'd like
marker(key, scope?)
or maybe
marker("scope.key")
like in comment marker/** t(scope.key) */
when used in scoped component/moduleDescribe alternatives you've considered
No response
Describe alternatives you've considered
-
Describe alternatives you've considered
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: