Skip to content
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

perf(multilingual-support): Multi-language Support #445

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

djurnamn
Copy link

What does this do?

This is another approach to adding multilingual support to 5e-database. It allows us to parse the source data and separate it into what should be translatable (locale) and what shouldn't be (templates). It also allows us to build the source data back together with an altered locale file, resulting in a translated version of the database. Please see the readme for more information!

How was it tested?

I have manually tested to take the original data apart and put it back together again using the scripts. The result almost perfectly replicates the original data. There's just one instance of a comma separated list in the original data where the and is second to last instead of last, which is the (otherwise reliable) pattern I've set up. I also wasn't able to perfectly replicate the json formatting options of the original data, so I made some changes to the source data (mainly indentation and newlines) to be able to compare the results more reliably.

Is there a Github issue this is resolving?

#81

I did have a look at the proof of concept that @carloslancha made a while back (#158). That helped me get started!

Did you update the docs in the API? Please link an associated PR if applicable.

I've added a readme in the subfolder. But this is pretty self-contained and non-intrusive. It doesn't affect how the API works.

Here's a fun image for your troubles

random photo - update me

@bagelbits bagelbits changed the title Multilingual support perf(multilingual-support): Multi-language Support Apr 1, 2022
@bagelbits bagelbits self-requested a review April 1, 2022 02:02
@djurnamn
Copy link
Author

djurnamn commented Apr 4, 2022

I did some more experimenting on this. It's not super pretty, but it seems to do the trick. The easiest way to test it is to:

  1. run npm run create-source-locale which will now create locales/en_us.json
  2. duplicate it and rename the copy to some other country code (and maybe change some of the values in the file as well)
  3. run npm run populate-templates which will now create a set of source files containing both languages in the desired shape (in the output folder)

I'll try to do some refactoring and documentation on this when I have more time (as it's not super straight forward). But feel free to test it out and let me know what you think!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant