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

Add internationalisation (see Hugo Learn Theme for reference) #24

Open
aral opened this issue Dec 25, 2017 · 5 comments
Open

Add internationalisation (see Hugo Learn Theme for reference) #24

aral opened this issue Dec 25, 2017 · 5 comments

Comments

@aral
Copy link

aral commented Dec 25, 2017

The Hugo Learn Theme has internationalisation by default. This would be a valuable addition to Cupper.

Reference: https://learn.netlify.com/en/
Source: https://github.com/matcornic/hugo-theme-learn

@GaetanBt
Copy link

GaetanBt commented Oct 3, 2018

Hello, do you have any news on this ?

@Heydon
Copy link
Contributor

Heydon commented Oct 3, 2018

@GaetanBt I believe (but may be mistaken) that this is supported already from core Hugo. See https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/

@GaetanBt
Copy link

GaetanBt commented Oct 3, 2018

Thanks for the link @Heydon, i'm new to Hugo !

Yeah it seems that it has a built in support for internationalisation. I was more thinking about a way to provide translations of the hard-written content inside the theme.

Maybe i'm missing a point somewhere but if you think it can be a good idea, I would be happy to help and work on French translations.

@Heydon
Copy link
Contributor

Heydon commented Oct 3, 2018

@GaetanBt Ah, I see what you mean. Good question (and thanks for offering to help). I'll try to find time to look into it. Let me know if you have any ideas.

@GaetanBt
Copy link

GaetanBt commented Oct 4, 2018

I drop some ideas,

First of all I just figured out that the language code set in the config.toml file is not used in the cupper/layouts/_default/baseof.html template.

Maybe we can start by using it like <html lang="{{ .Site.LanguageCode }}"> ?

I don't know if we are allowed to create directories and files in a Hugo theme but we could store translations in a specific locales (or anything) folder with json files.
We could create a json file per locale and then, require it in the template depending on the global languageCode configuration.

To organise the translations we could prefix each key by the subject of the concerned file.

For example :

{
  "shortcodes-warning-ariaLabel": "warning",
  "layout-skipToContent": "skip to content",
  "layout-printVersion": "Print version",
  "layout-darkTheme": "dark theme"
}

Or maybe we could split this in multiple files depending on the subject :

|-- locales
|    |-- en-us
|        |-- layout
|            |-- locale.json
|        |-- shortcodes
|            |-- locale.json

Or even filter like this :

|-- locales
|    |-- layout
|        |-- en-us.json
|        |-- fr-fr.json
|    |-- shortcodes
|        |-- en-us.json
|        |-- fr-fr.json

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

3 participants