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

Allow defining defaults in the "i18next-extract-mark-context-next-line" directive #218

Open
ymoran00 opened this issue May 4, 2022 · 1 comment

Comments

@ymoran00
Copy link

ymoran00 commented May 4, 2022

I have the following tranlation in code:

// i18next-extract-mark-context-next-line ["type1", "type2", "type3"]
t('label', 'Type-1', {context: type})

There are 3 possible labels here, dependent on "type" prop.
When I run i18n-extract I need to translations json to have this entry:

labe_type1: "Type-1",
label_type2: "Type-2",
label_type3: "Type-3"

But since there is no way to define the defaults in the i18next-extract-mark-context-next-line directive, what I get is:

labe_type1: "",
label_type2: "",
label_type3: ""

This means that each time I run extraction, my English dictionary gets overwritten for these keys with empty values.
I need a way to define the expected defaults also in the i18next-extract-mark-context-next-line directive

Possible solution is to allow the directive to be written like this:

// i18next-extract-mark-context-next-line ["type1=Type-1", "type2=Type-2", "type3=Type-3"]

or something to that effect (whatever fits best the current comment scheme.

@jmtt89
Copy link

jmtt89 commented Jun 2, 2022

maybe a simplest solution can be add a new comment to specify custom extractions like

// i18next-extract-mark type1 type-1
// i18next-extract-mark label defaultValue

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

No branches or pull requests

2 participants