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

Add visit to make MessageReference and Term recognize VariableReference #11

Closed
andrew000 opened this issue Nov 22, 2024 · 0 comments · Fixed by #12
Closed

Add visit to make MessageReference and Term recognize VariableReference #11

andrew000 opened this issue Nov 22, 2024 · 0 comments · Fixed by #12
Assignees
Labels
enhancement New feature or request

Comments

@andrew000
Copy link
Owner

Term recognition

Term may exist in .ftl and FTL-Extract will not touch them. Be careful when creating a Term, as a syntax error in it will return an error FTLExtractorCantFindTermError.
If using Term with common Message, Term should contain all VariableReferences required by Message, or Message will be commented.

-selector =
    { $lang ->
        [uk] { $lang }, Ok
       *[other] { $lang }, 🤔
    }
test-message = Some text { -selector }
async def test(i18n: Any) -> None:
    i18n.test.message(lang="uk")

MessageReference recognition

MessageReference references on another Message with VariableReferences. This Message must exist in code, or it will be commented and will show error FTLExtractorCantFindReferenceError. In example test-message references on show-lang with VariableReference "$lang".

show-lang =
    { $lang ->
        [uk] { $lang }, Ok
       *[other] { $lang }, 🤔
    }
test-message = Some text { show-lang }
async def another_place(i18n: Any) -> None:
    i18n.show.lang(lang="uk")

async def test(i18n: Any) -> None:
    i18n.test.message(lang="uk")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant