The ClaimChunk website.
You'll need the mdbook and mdbook-i18n-helpers crates to build this :)
- Install Rust language development binaries (I recommend via Rustup, but it's up to you).
- Install mdbook using
cargo install mdbook
- You can download binaries directly from their GitHub for your operating system, but step 3 requires cargo anyway.
- Install mdbook-i18n-helpers with
cargo install mdbook-i18n-helpers
- Install GNU Gettext utilities for your operating system:
- Mac:
brew install gettext
- Windows: Precompiled binaries available via this link.
- Linux:
apt install gettext
(Forget if you need sudo, give it a shot without for single user binaries)
- Mac:
For the following snippets, I'll assume a bash system. If you use Windows, you will have to modify the way you set environment variables. You can't set them same-line (as easily), so replace things like
MDBOOK_OUTPUT='{"xgettext": {}}' mdbook build -d po
with (note the escapes):
set "MDBOOK_OUTPUT='{\"xgettext\": {}}'" && mdbook build -d po
So those are the dependencies, now to get started. I first recommend reading the USAGE.md file for the mdbook-i18n-helpers crate.
(Make sure your working directory is the claimchunk-site main directory)
- Generate manually:
- Use the following line to generate the
po/messages.pot
file, containing all the unlocalized strings for translation.MDBOOK_OUTPUT='{"xgettext": {}}' mdbook build -d po
- Use this command to copy that template file for your specified language (replace XX with the 2ish character identifier for the language):
msginit -i po/messages.pot -l XX -o po/XX.po
- Use the following line to generate the
- Or automatically:
sh scripts/new-language.sh XX
If new content is added to the central English version of the site, you can run this command to merge the new content into your pre-existing translations.
MDBOOK_OUTPUT='{"xgettext": {}}' mdbook build -d po
msgmerge --update po/XX.po po/messages.pot
or
sh scripts/update-language.sh XX
I highly recommend using a dedicated editor for PO files to prevent syntax errors. pofile.net has a free in-browser editor so you don't need to install anything, and poedit.net is a good alternative application (Pro plan is unnecessary).
Simply open up the XX.po
file in the /po
directory for your specific language using one of those (or a different) editor and translate the source material to your language :) If you need any help getting this set up or translating, feel free to reach out via our Discord or submit an issue on this repository.
Changes to those file can be submitted via pull request and I'll add them to the language menu!
To generate the translations and build the book, you can run:
sh scripts/single-build.sh <FEW_LETTER_LANG_IDENTIFER> <OUTPUT_DIR>