Skip to content

cjburkey01/claimchunk-site

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claimchunk-site

The ClaimChunk website.

Setup

Install

You'll need the mdbook and mdbook-i18n-helpers crates to build this :)

  1. Install Rust language development binaries (I recommend via Rustup, but it's up to you).
  2. Install mdbook using cargo install mdbook
    • You can download binaries directly from their GitHub for your operating system, but step 3 requires cargo anyway.
  3. Install mdbook-i18n-helpers with cargo install mdbook-i18n-helpers
  4. 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)

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

Generating a PO file for a new language

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)

  1. Generate manually:
    1. 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
    2. 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
  2. Or automatically:
    sh scripts/new-language.sh XX

Updating your PO file after new English content

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

Translating

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!

Seeing your translations

To generate the translations and build the book, you can run:

sh scripts/single-build.sh <FEW_LETTER_LANG_IDENTIFER> <OUTPUT_DIR>