Skip to content

gaphor/gaphor.github.io

Repository files navigation

The theme is based on the Illdy theme.

Development Environment with Linux

Install rbenv and ruby-build

$ rbenv install 2.7.5
$ rbenv global 2.7.5
$ gem install ruby bundler
$ bundle install
$ bundle exec jekyll serve

Translation

This project is using the jekyll-polyglot plugin.

There are two different ways in which content on the website is translated.

Strings

If you are adding content to the home page, footer, navigation, or other static parts of the website, not Jekyll posts/pages, then it is done using localised site data.

Say you want to add a new paragraph to the home page. Firstly, add a new entry to the _data/strings.yml file:

index:
  thousand-words: >
    A picture is worth a thousand words. Describe and document your
    applications and systems with Gaphor to enhance knowledge sharing.
...

Then, reference this from the index.html file:

{{ site.data.strings.index.thousand-words }}

If you need to reference many strings in a single .md file, then it is also possible to first assign a variable:

{% assign strings = site.data.strings.index %}
{{ strings.thousand-words }}

Pages and Blog

For the pages and posts, translation happens by conversion Markdown into gettext using po4a. When a new .md file is added to _pages/ or _posts/ directory, then you need to run:

$ python po/build.py

This will extract the strings from all Markdown files in these two directories and output them to po/site.pot. These will then subsequently be translated by Weblate into additional files such as po/site.cs.po.

Configuring Weblate

The translation setup is designed to work with three different Weblate Components:

  • Website (navigation, footer, sidebars)
  • Pages and Blog
  • Website News

Below is the list of important properties to set when adding a new Weblate component. These are important or else the translation system will not work. It does not document the more simple things such as Name/URL/etc.

Website

  • File mask: _data/*/strings.yml
  • Monolingual base language file: _data/strings.yml
  • Edit base file: No
  • Base file for new translations: _data/strings.yml
  • File format: YAML file
  • Priority: Very high

Pages and Blog

  • File mask: po/site.*.po
  • Edit base file: No
  • Base file for new translations: po/site.pot
  • File format: Gettext PO file