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

i18n functions everywhere #16372

Closed
wants to merge 2 commits into from

Conversation

schlawg
Copy link
Collaborator

@schlawg schlawg 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

@ornicar
Copy link
Collaborator

ornicar commented Nov 8, 2024

I'm not quite sure we want this just yet. Will keep the PR in reserve for later.

@schlawg
Copy link
Collaborator Author

schlawg commented Nov 8, 2024

It's a response to the issue you raised about javascript based i18n and exceptions, but I don't like it either.

@schlawg
Copy link
Collaborator Author

schlawg commented Nov 8, 2024

i can't really commit to keeping it around on github.com/schlawg as i don't think twice about warnings on git push -d for anything older than 2 weeks. should i move it to github.com/lichess-org or can we just close it?

@ornicar
Copy link
Collaborator

ornicar commented Nov 8, 2024

#16378

@ornicar ornicar closed this Nov 8, 2024
@schlawg schlawg deleted the ui-i18n-functions-always branch November 8, 2024 15:01
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