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
[PR] Gh pages Localization structure #426
Conversation
_config.yml
Outdated
@@ -8,7 +8,10 @@ slim_docs_versions: v2, v3, v4 | |||
slim_website_repo: https://github.com/slimphp/Slim-Website/tree/gh-pages/ | |||
urlBasePath: | |||
include: [.htaccess] | |||
exclude: [node_modules] | |||
exclude: [node_modules,.idea] | |||
l10nDefaultLang: gb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be en
instead of gb
?
_config.yml
Outdated
@@ -298,3 +299,18 @@ defaults: | |||
type: "pages" | |||
values: | |||
layout: docs-v2 | |||
t: | |||
blog: | |||
gb: "Blog" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gb
should be en
for all occurrences below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as of country/language codes I have a table published there https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
With such a naming convention we should use English flag rather that GB.
in case of Brazil-Portuguese we would go for br
rather that for pt
.
Also, the gb
goes nicely with famfamfam
flag naming
Shall I change it anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should change this to en
. See https://en.wikipedia.org/wiki/ISO_639-1. This is a language and not a region (country) after all.
@adriansuter this looks good to me. |
@janfkowalski I built the branch on the dev server and there's a bug on the front page. The label "Community" does not show up. |
support: | ||
en: "Support" | ||
community: | ||
gb: "Community" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you forgot to change this label to en: "Community"
Follow in #432 |
Localization for slimphp/Slim-Website (gh-pages)
Changes
New variables
Templates now have two new
front-matter
variables in use:l10n-link
- utilized in_includes/languages.html
to determine if same content is available in other languages. If there is corresponding document in different languages then the flags will be diplayed. The convention is to use<directory_name>-<version>-<filename>
where hyphens in filename are replaced with underscores. i.e. variablel10n-link
in document in section 'Concepts' for version 4 with filename 'dependency-injection.html' would have valueconcepts-v4-depency_injection
l10n-lang
- determines documents language. The default should been
._config.yml changes
Two new variables are present in the
_config.yml
file:l10nDefaultLang
- determines default language of the website. default value isen
.l10nLanguageLabels
- is an array which has language code as index and name as value.New templates
Language switcher in included in new template
_inlcudes/languages.html
which is included from_includes/header.html
.Changes to existing *.html files
l10n-link
andl10n-lang
to every *.html file indocs
directory,/blog/index.html
andcontribute/index.html
.How to use it
Directory structure
Content in language other than the
l10nDefaultLanguage
should be stored in the {{lang}} directory on the Application level.Config changes
In order to add new language
path
index. i.e.path: "pl/docs/v4"
orpath: "fr/docs/v4"
.l10nDefault
language as the fallback.First two sections will redirect to translated content where other will redirect to the default language page.
** Note ** This is utilized in
sidebar
for user-guide. If localized content is not available then the flag for thel10nDefaultLang
will be displayed.Other Notes
Flags (images)
You can download the country flag from Famfamfam page and save your image file into
./assets/images/flags/
Learning jekyll? Try these:
Useful links:
Issues with Jekyll
Custom plugins are just not working. Tried to use on Ubuntu18 but no luck. Seems to be Jekylls thing.
As an effect plenty of logic tasks are solved in templates.
Issue with plugins. None of the three methods described worked.
TODO