-
Notifications
You must be signed in to change notification settings - Fork 22
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
chore(i18n): add a 'count=1' overwritable global variable #3318
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: John Cowen <[email protected]>
✅ Deploy Preview for kuma-gui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Taking this out of draft, but only so it opens up review. Still kinda in a "not even sure I want to merge this" state |
I also have mixed feelings 🤔 to me it feels more natural if there is no global |
From what I remember I also thought
I suppose anywhere where we refer to a key/prop. The idea would be that we would do this for a multiple props, not just |
Oh, my assumption might be wrong about this 😅 will double check again
Hmmm 🤔 but in the case of |
We don't need to add anything, but we should do, ideally we would completely delete the camelCase thing. I think in the case of resources names it would be particularly handy, I'm not totally sure they would go in meshes:
resourceName: { count, plural,
=0 { Meshes }
=1 { Mesh }
other { Meshes }
} t('meshes.resourceName') // Mesh because of global `count`
t('meshes.resourceName', { count: items.length }) // Meshes
...
t('etc.resourceName') // Thing because of global `count`
t('etc.resourceName', { count: items.length }) // Things |
Ok, I like that and agree here 👍
I wasn't sure sure if we really need both singular and plural for resource names, but at least for page titles and breadcrumbs we might need it. But setting global count to 1, for titles that would mean t('meshes.resourceName', { count: 2 }) // Meshes Looks a little odd to me 🤔 Or would you treat page titles differently? Like t('meshes.routes.items.title') // Meshes |
Hmm yeah to me too 🤔 , not sure if this pushes it too far but maybe we make:
(note plural is an option not a param) turn into Maybe a bit too much magic there though, still thinking myself, but lemme know if you had any thoughts on that one ^ |
It would be nice to use pluralization via our i18n more (instead of hardcoding both singular and plural forms as separate keys)
I've kinda experimented with this before, so this more of sharing that thinking and therefore this PR might not eventually be merged.
This PR adds a default
count
"global" variable.We already have an idea of global variables but they are almost like environment variables and cased so.
Why do we need a
count
global variable?I've included a
name
example in this PR. Almost every resource in our application has a httpname
property and we use that term everywhere in our UI. Sometimes we wantnames
and sometimes we wantname
.Instead of having two keys:
or worse
we could just have one:
The thing is that would mean you always have to pass a
count
which is annoying.I tried some other ideas first (such as checking the error returned when count was missing) but seemed too over-complicated.