Basic i18n implementation#60
Basic i18n implementation#60oncleben31 wants to merge 17 commits intojekyll:masterfrom oncleben31:basic-i18n
Conversation
# Conflicts: # _layouts/home.html
|
Lovely, I dig the use of When setting # Basic i18n
# uncomment the line below to have minima
# use the data in _data/locales/[lang].yml
#
# lang: fr
and hence wont explicitly need a The second approach (preffered but not possible as of now) is to simply remove the default filters in the liquid tags for i18n strings: <h1 class="page-heading">{{ site.data.locales[site.lang].posts }}</h1>
<p class="rss-subscribe">{{ site.data.locales[site.lang].subscribe }}
<a href="{{ "/feed.xml" | relative_url }}">{{ site.data.locales[site.lang].via_RSS }}</a>
</p>But the problem with this is Jekyll doesnt read data files from within the gem as of v3.3 so we cant ship default locale data alongwith the gem, and the user will have those strings missing from their site till he manually adds |
|
Overall, this PR LGTM so far except for that small nit I mentioned above.. Also, please change to a more descriptive title.. |
|
Thank you for you very constructive comments. I will work on it next week. |
|
@ashmaroli any recommandation for the location to store the [lang].yml files ? My first opinion was on |
|
One way is to store the data files in this repo itself.. like in your PR.. as |
|
My PR is ready for review with strings and dates translation. /cc @ashmaroli |
| {% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%B", replacement %} | ||
| {% endif %} | ||
|
|
||
| {{ include.date | date: date_format_to_be_translated }} |
There was a problem hiding this comment.
Whoa! that's a LOT of assignments.. IMHO, there has to be a better way to have this implemented..
I advice you use comments to provide embedded documentation for this. Helps others who read your code..:
{% comment %}{% endcomment %}for liquid comments that do not get carried over to final site markup, and<!-- -->for attribution (the source of this code, for example, with licence info, if available.) that does get carried over to site markup.
example/_config.yml
Outdated
| ### Basic localisation (l10n) | ||
| # If you customize the lang parameter, minima will try to use the strings in _data/locales/[lang].yml | ||
| # Read https://github.com/jekyll/minima/README.md for more information. | ||
| #lang: fr |
There was a problem hiding this comment.
I prefer comments to always have a whitespace after the #. Looks better.
(Plus, it doesnt seem like a reference-tag..
like how we would link to a heading in HTML e.g. /about.html#work-experience though I agree, its of no significance here.)
example/_config.yml
Outdated
|
|
||
| # Even the day and month names will be translated. You can customize your date by | ||
| # uncommenting the following line and customizing the date format: | ||
| #date_format: "Le %-d %B %Y" |
| - oct. | ||
| - nov. | ||
| - déc. | ||
| full_month: |
There was a problem hiding this comment.
why use lowercase names suddenly? If en.yml has Jan. | Feb., fr.yml should also be Jan. | Fev. etc
There was a problem hiding this comment.
FYI in french the standard format for dates use months in lowercase. Like "Mercredi 12 octobre 2016"
There was a problem hiding this comment.
😃 Yes, I'd struck that comment out when I learnt about this convention..
|
Not a big fan of having an
If, |
| 3. (optional) change the `date_format` parameter in `_config.yml` by using the [date filter syntax](https://help.shopify.com/themes/liquid/filters/additional-filters#date). The day and month names will be translated. | ||
|
|
||
| -- | ||
|
|
There was a problem hiding this comment.
Missed this.. you'll need some editing done here as well..
See how this section looks like in your repo.. ?
|
@ashmaroli your comments have been taken into account. |
|
Thank you very much @oncleben31, I would still additionally add a new line between every 👍 for the effort put in this PR.. /cc @jekyll/minima Any comments? |
|
Closing this, as we don't intend to support i18n in this theme. Thanks for your effort @oncleben31 |
So I've redo my try to put some basic i18n. This time it's more clean and I use yaml files to store the locales strings.
It still work in progress as there are two points on my todo list:
make it work with the locales files in the theme folder not in the example/_data folder(Edited not possible currently)cc/ @ashmaroli Have you any comment on that ?