homebrewery icon indicating copy to clipboard operation
homebrewery copied to clipboard

Modify Homebrewery strings to allow alternate languages

Open G-Ambatte opened this issue 2 years ago • 13 comments

Your idea:

Modifying Homebrewery to use a file containing all of the text strings presented to the end user will allow the creation of string files for alternate languages, and the site can then be switched between translations as desired by the user.

G-Ambatte avatar Jan 22 '23 22:01 G-Ambatte

If this feature is approved, i will take responsability for the Spanish (es-es) and Catalan (ca-es) translation, for the forseeable future.

i'm guessing once more than one language is set up, adding extra languages should be a minor tweak, just another json file maybe.

5e-Cleric avatar Jan 22 '23 22:01 5e-Cleric

Issue #116 might be a problem

5e-Cleric avatar Jan 30 '23 23:01 5e-Cleric

Issue #116 might be a problem

#115 is talking about fonts used in brews. This issue is mainly about the UI strings, which is Open Sans.

Unless we're also talking about translating the strings used in the sample snippets?

ericscheid avatar Jan 30 '23 23:01 ericscheid

Yes, but i would argue that the fact that we translate the UI might make users try to homebrew in their native language, which will get to #116 blocking their progress, let's make this and then we can look into fixing those fonts, yeah?

5e-Cleric avatar Jan 31 '23 08:01 5e-Cleric

Yep, one ~~disaster~~ issue at a time.

Also, the brew-document lang doesn't have to be the same as the UI lang. But we know this.

Also, see #1343 for related lang matters ..

hmm .. if someone set their brew lang to es, but kept the UI lang as en .. would the snippets as inserted be in es or en? I would think so. But would the snippet names in the UI also swap to es? Probably not, right?

ericscheid avatar Jan 31 '23 09:01 ericscheid

Snippet names is UI, but content is brew, if a user sets UI lang to es but brew lang to en, the snippet name should change, but the content of it should still be in english.

At least that's what makes sense to me.

Also, we should include language in User settings #1908, do we know when will that be merged? so we have a time limit.

Both are right now in hands of @jeddai i believe, so we need their take on this.

5e-Cleric avatar Jan 31 '23 14:01 5e-Cleric

Trying to jump start this issue, or at least get someone else's view on how I could start making progress towards the defined goal.

I believe the original idea was to have a YAML file for every desired UI language, each storing string references and their content in that specific language.

We should come up with a naming convention for strings, to achieve consistency and avoid chaos. Any ideas on that front? This is obviously just for User facing strings.

This is the first draft for such a YAML file. base-localization-file.zip (can't upload a YAML file to GitHub)

5e-Cleric avatar Dec 20 '23 10:12 5e-Cleric

Having defined names for specific instances of strings is one approach.

Another approach is to skip the naming entirely, and have the base English strings be the lookup keys, This approach has pros and cons. (Technically, it's still a key:value pairing, it's just that the keys are things like "are you sure you want to log off?" instead of LogOutConfirmQuery).

ericscheid avatar Dec 20 '23 20:12 ericscheid

I believe the original idea was to have a YAML file for every desired UI language

I didn't get that impression.

It could instead be one file, maybe like:

accounts-and-session-management:
  Are you sure you want to log off?:
    en-au: Oy mate, be onyer bike now, eh?
    es: ¿Estás seguro/a de que quieres cerrar sesión?
    es-mx: ¿Estás seguro/a de que quieres cerrar sesión?
    fr: Êtes-vous sûr(e) de vouloir vous déconnecter ?
    pt: Tem certeza de que deseja sair?
  another english string:
    (etc)

ericscheid avatar Dec 20 '23 20:12 ericscheid

There would be little difference, i guess your approach is easier to implement and smaller in size, let's do that

5e-Cleric avatar Dec 20 '23 21:12 5e-Cleric

Using ChatGPT to do the bulk of the work, and the first draft of the localization file, i got a nice starting point:

Second version localization file.zip

5e-Cleric avatar Dec 20 '23 21:12 5e-Cleric

I follow this issue, as i would love to translate to French

lucastucious avatar Jan 04 '24 23:01 lucastucious

@lucastucious and others, you can follow the instructions given in this document: https://homebrewery.naturalcrit.com/share/aOAoEOu6BjHa

5e-Cleric avatar Jan 30 '24 21:01 5e-Cleric