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

Need multiple language support #10

Open
Faridbabayev001 opened this issue Oct 23, 2023 · 2 comments
Open

Need multiple language support #10

Faridbabayev001 opened this issue Oct 23, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Faridbabayev001
Copy link

Hello. First of all, it's a great system. Mainly the UI part. I would like to thank everyone who contributed.

The system currently supports one language. All static words are in English. Can you add multiple language support to the system? There is no language option in the menu. It is enough to have a json file for each language inside the code (for example, en.json). I can rename the json file before building and rebuild that way. I want to use it as a dictionary. I want all the content of the site to be in the same language. I tried changing the static words from within the code. But this is very difficult. I think it would be great if you could add multiple language support to the system.

P.S Sorry for my English

@hilverd
Copy link
Owner

hilverd commented Oct 24, 2023

Hi -- thank you for suggesting this!

I like the idea and will try to spend time on this after I manage to get the next "major" version released (I'm currently working to add support for tags along with other improvements). It might take a little while.

@hilverd hilverd added the enhancement New feature or request label Oct 24, 2023
@hilverd
Copy link
Owner

hilverd commented Dec 8, 2023

I think I have made some progress with this.

There is now a folder called Internationalisation. Each file in this folder contains all the UI text for a specific language. The files are named according to ISO 639-2 codes. They contain Elm code rather than JSON because that seemed much easier, but the code should not be very complicated to work with.

The file Internationalisation.elm determines which language is used. By default it uses English:

import Internationalisation.Eng as I18n

For example, to switch to Dutch, you can change that line to

import Internationalisation.Nld as I18n

and then run a build:

pnpm run build
./bin/prepare-release
cd release
tar -zvxf glossary-page-template-*.tar.gz

This is not very sophisticated (and I'm assuming more work is needed to support e.g. languages with a right-to-left script) -- but maybe it is good enough for your use case?

If it is good enough then a pull request with a translation would be very welcome 😄. I could then make other languages available in releases.

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

No branches or pull requests

2 participants