Translation handling (#142)#143
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
==========================================
- Coverage 40.77% 33.33% -7.44%
==========================================
Files 9 11 +2
Lines 363 477 +114
Branches 53 92 +39
==========================================
+ Hits 148 159 +11
- Misses 210 313 +103
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
544d735 to
01a4f8c
Compare
|
Updated the PR with the remaining parts: CI check for UI translation keys and a centralized t() in the store so all static lookups go through one place |
01a4f8c to
3f89d54
Compare
|
lk still needs a bit more work, will comment again when it looks good |
421ad12 to
e4038e4
Compare
|
Tested locally with a Spanish locale build. Screen below to show:
CI status:
Should be good for review. Screen.Recording.2026-03-24.at.1.08.59.PM.mov |
benoit74
left a comment
There was a problem hiding this comment.
It is important to note that check_ui_keys.py does not ensure placeholders are matching what we expect, which is fine to me because it is too hard to implement / too risky to break every now and then.
It is also important to note that locale_validation.py does check placeholders for non-dynamic keys, and does check dynamic keys are all present. This is good.
I feel like we should
- extend
locale_validation.pyto check that dynamic keys in addition to being present are not using any placeholders (since we do not expect them to) - also use
main.t(...)for dynamic keys (or is there a blocker for that?) so that we have a consistent code in the whole app - make
localesIntroand others of the like "private" (prefixed with_) in main store so that it is clearer we should avoid to use them (or really private if you have some idea of how to do that in a simple way)
WDYT?
|
Makes sense, all three seem doable. I'll add the placeholder check for dynamic keys to locale_validation.py since the regex logic is alr there, and extend t() to handle dynamic paths. For the private state, I'll prefix the locale properties with _ since Pinia doesn't have true private state support. One question on the motivation data though, compliments.random() and motivationalQuotes.random() are array based, not keyed string lookups, so they don't really fit the t() pattern. Should I add separate getter methods for those or leave them as is? |
What about passing |
|
For dynamic intro keys I went with a separate tIntro() instead of routing them through t() since the intro lookups return string | string[] since the paragraphs come as arrays, so they don't really fit t()'s string return type |
benoit74
left a comment
There was a problem hiding this comment.
LGTM, please squash your commits and I will merge. Well done.
Re TS7056 hack: OMG ... nice
aa9173e to
67fdcc8
Compare
|
good to go |
Closes #142
t()function in the main store