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

Implement default_variables in i18n.translate #1379

Open
sveneberth opened this issue Jan 23, 2025 · 1 comment · May be fixed by #1364
Open

Implement default_variables in i18n.translate #1379

sveneberth opened this issue Jan 23, 2025 · 1 comment · May be fixed by #1364
Labels
feature New feature or request Priority: High After critical issues are fixed, these should be dealt with before any further issues.

Comments

@sveneberth
Copy link
Member

I want to translate this tooltip:

scope_code = StringBone(
    params={
        "category": "2 – Scope",
        "visibleIf": 'code_type == "universal"',
        "pattern": rf'^[{"".join(CODE_CHARS)}]+$',
        "tooltip": i18n.translate(
            "viur.shop.allowed_characters",
            defaultText="allowed characters: {{chars}}",
        )(chars=CODE_CHARS),
    },
)

I know the variable chars before the translation string should be resolved with the request language. But at this point I cannot provide the variables.

We should extend i18n.translate's __init__() with a default_variables parameter and later merged this together with kwargs in translate()

@sveneberth sveneberth added feature New feature or request Priority: High After critical issues are fixed, these should be dealt with before any further issues. labels Jan 23, 2025
@sveneberth
Copy link
Member Author

sveneberth commented Jan 23, 2025

sveneberth added a commit to phorward/viur-core that referenced this issue Jan 25, 2025
@sveneberth sveneberth linked a pull request Jan 25, 2025 that will close this issue
10 tasks
@sveneberth sveneberth linked a pull request Jan 25, 2025 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request Priority: High After critical issues are fixed, these should be dealt with before any further issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant