Closed asvae closed 2 years ago
{ "landing_header_buttons_overview": "Overview" }
We can use dots instead of underlines which is easier to copy & paste.
{
"landing.header.buttons.overview": "Overview"
}
$t('landing.header.buttons.overview')
@m0ksem pretty sure it'll break vue i18n (it will try to resolve nested). how exactly are dots easier to copy?
After translating the documentation into Russian, I can highlight the following cons of flatten structure:
In general, refactoring is necessary for locales, but you might consider post-generation of a flat locale file, for example, collapse the path into a string (key).
For example:
// Convenient navigation, clear structure
{
"shared": {
"overview": "Overview",
"description": "Description",
"notification": {
"success": "Success notification",
"error": "Error notification"
}
},
"someModule": {
"name": "Some module name"
}
}
// Flatten structure, difficult to search option
// You will need to keep the key pattern in mind
{
"shared_overview": "Overview",
"shared_description": "Description",
"shared_notification_success": "Success notification",
"shared_notification_error": "Error notification",
"someModule_name": "Some module name"
}
A non-object approach is not intuitive for developers, therefore, describing translations of documentation will be annoying.
Hmm. Fair point. I guess we can just add:
And call it a day.
@m0ksem dot-separator difficult to understanding, because it means object path. _
and word divided by _
supported double click, it's better for Ctrl+C -> Ctrl+V
=)
@asvae I can do this, anyway the next task is about locales.
@mxmvshnvsk sure, thanks.
Won't be able to update this issue today, but feel free to ping me in discord. :)
How about making a simpler file structure?
- locale
- pages
- examples
- example.vue
- ...
- page-config.ts
- page.vue
In this case, we can add the locale files to the page. Then merge it into one global locale. This will be more complex, but we will have fewer larger locale files. I'm not sure we really need this, but it's an idea.
- locale
// Global locales like vmodel, input, value etc.
- en.json
- ru.json
- es.json
- pages
- locale
- en.js
- ru.js
- es.js
- examples
- example.vue
- ...
- page-config.ts
- page.vue
@m0ksem I would leave one file for now, just for ease-of-support.
We might make more translation files when docs grow up as we'd need to lazy load translations most likely.
Currently in translations we have nested collection.
That's not ideal because:
Instead we can try flat collection.
Here's an example of flat collection:
Implementation
introduce a script that
some.translation
, neversome.${translation}
).You can use yargs to introduce arguments, but generally we want this script to "somehow work", as it's probably going to be used once, then forgotten. So speedrunning this task would make the most sense.
Bonus points