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

How to use translations if I add it to the translations.yml? #192

Open
alibabagogogo opened this issue Jan 9, 2023 · 2 comments
Open

How to use translations if I add it to the translations.yml? #192

alibabagogogo opened this issue Jan 9, 2023 · 2 comments

Comments

@alibabagogogo
Copy link

Hi, thanks a lot for sharing this theme. How to enable the translation between English and translated language? e.g. Chinese.
I've added the content to the translations.yml already, but nothing is changed.

  1. Is there a way to explicitly change the language? like, setting up a button on the right-top corner.
  2. if no, it will be auto-enable based on what criteria? IP? browser setting? or what ?

Thanks in advance.

@thiagorossener
Copy link
Owner

Hi @alibabagogogo, great you enjoyed the theme. Translations should work automatically after editing the translation variables and build the site.

So, if you cloned the repo, make sure you created the translations.yml file inside src/yml folder. If you're using the gem, add the content from here in your _config.yml file.

The site should be translated on your next build after doing that. Let me know if you have any issues.

@alibabagogogo
Copy link
Author

Hi @thiagorossener , thanks a lot for your immediate feedback.

I did 'get clone' from your repo at the very beginning and I forked it as well. There is a blank translations.yml file in src/yml folder. I added your samples with some changes on values.

I build the site by gulp and by bundle exec jekyll serve. Neither way works in translation. The values of site.yml etc. will be updated in _config.yml after rebuild, but I cannot tell there is anything changed related to translations.yml.

Sorry I'm new to the coding part, so if I describe the process as a layman, yeah, I am the layman.. .

If my understanding is correct, every time I rebuild the project, the *.yml in src/yml will be 'gethered' into _config.yml and it will be used as 'rules' to bulid pages in _site. If this is correct, where does the translation mappings stores after rebuilding?

say

{{ site.translations.text.comments | default: "Comments" }}

in _includes folder? translations.yml? Or other new source after build?

Thanks a lot for helping!

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

No branches or pull requests

2 participants