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

ui i18n functions #16378

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

ui i18n functions #16378

wants to merge 2 commits into from

Conversation

ornicar
Copy link
Collaborator

@ornicar ornicar commented Nov 8, 2024

now all i18n keys require a function call.

console.log(i18n.site.yes()); // prints 'Yes'

console.log(i18n.site.no); // prints '(...t)=>l(e,...t).join("")'

console.log(i18n.study.perPage(12)); // if we don't have study i18n, prints 'perPage'

console.log((i18n.storm as any).nonExistentKey(6, 'ignored')); // prints 'nonExistentKey'

typescript only allows any and never coercion to string, but it doesn't do this with function objects or any other type. therefore, snab typings preclude treating a raw i18n functor as a VNode parameter. so within any snabbdom builder, you must call the function object or it won't compile

@schlawg
Copy link
Collaborator

schlawg commented Nov 8, 2024

thanks!

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

Successfully merging this pull request may close these issues.

2 participants