coracle icon indicating copy to clipboard operation
coracle copied to clipboard

Started svelte-i18n integration

Open papiche opened this issue 9 months ago • 2 comments

To inform about "work in progress" Added language selector using svelte-i18n

When used in code, it replaces fixed text with dynamic

For example, in ./src/app/MenuDesktop.svelte Settings becomes {$_('page.home.settings.title', { default: 'Settings' })}

then sentence is displayed according to ./src/app/localization/lang/LANG.json

Before translating, this needs to get widely applied to populate "en.json" with all sentences. Is it OK for you ? How would you like we get organized ?

papiche avatar Feb 09 '25 00:02 papiche

This looks quite good, thank you! I will likely move the language selector somewhere less visible ultimately. My one question is whether it would make sense for commonly used terms (like "Relay") to get their own key? Probably premature abstraction, but I don't know what best practices are here.

staab avatar Feb 09 '25 01:02 staab

would make sense for commonly used terms (like "Relay") to get their own key

As mean can change from context and synonyms can be used, it is better to make translation for each application routes like :

{
"page": {
  "home": {
    "feeds": "Feeds",
    "relays": "Relay",
    ... },
  "notes": { ...
    },
  "settings": { ...
}

I must still explore and discover Coracle to be able to make a complete i18n json To get help, i'm trying to get in touch with @Cristol-7 (https://github.com/coracle-social/coracle/issues/561) ...

Let's see how it goes ;)

papiche avatar Feb 10 '25 08:02 papiche