aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-12-03 18:56:32 +0100
committerDaniel Schadt <kingdread@gmx.de>2022-12-06 18:39:20 +0100
commitacce7c38d3833b59c4eb2e99dbe7f0393b6a9cbd (patch)
tree2b07366e650feeee94ae77fa1d74ed36bb5a4f7b
parentb9628678de72793e1bf0ad10f8c842c5bcb7dc10 (diff)
downloadfietsboek-acce7c38d3833b59c4eb2e99dbe7f0393b6a9cbd.tar.gz
fietsboek-acce7c38d3833b59c4eb2e99dbe7f0393b6a9cbd.tar.bz2
fietsboek-acce7c38d3833b59c4eb2e99dbe7f0393b6a9cbd.zip
replace Makefile targets with justfile
We might re-introduce Makefiles, but for different purposes (SASS or TypeScript compilation).
-rw-r--r--Makefile16
-rw-r--r--doc/developer/localize.rst22
-rw-r--r--justfile19
3 files changed, 30 insertions, 27 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 1fe2185..0000000
--- a/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-PYBABEL=".venv/bin/pybabel"
-LOCALE="en"
-
-babel-extract:
- $(PYBABEL) extract -F babel.cfg -o fietsboek/locale/fietslog.pot --input-dirs=fietsboek
-
-babel-update:
- $(PYBABEL) update -d fietsboek/locale -l $(LOCALE) -i fietsboek/locale/fietslog.pot
-
-babel-compile:
- $(PYBABEL) compile -d fietsboek/locale -l $(LOCALE) -i fietsboek/locale/$(LOCALE)/LC_MESSAGES/messages.po
-
-babel-init:
- $(PYBABEL) init -d fietsboek/locale -l $(LOCALE) -i fietsboek/locale/fietslog.pot
-
-.PHONY: babel-extract babel-update babel-compile
diff --git a/doc/developer/localize.rst b/doc/developer/localize.rst
index c345c3e..91a51eb 100644
--- a/doc/developer/localize.rst
+++ b/doc/developer/localize.rst
@@ -43,11 +43,11 @@ In order to do so, use the :program:`pybabel` binary:
.venv/bin/pybabel extract -F babel.cfg -o fietsboek/locale/fietslog.pot --input-dirs=fietsboek
-The :file:`Makefile` contains a shortcut for this command:
+The :file:`justfile` (requires just_) contains a shortcut for this command:
.. code:: bash
- make babel-extract
+ just extract-messages
Creating a New Language
-----------------------
@@ -60,12 +60,6 @@ generate the ``.po`` file containing the messages using :program:`pybabel`:
# Replace LOCALE with the locale name, for example "nl" or "fr"
.venv/bin/pybabel init -d fietsboek/locale -l LOCALE -i fietsboek/locale/fietslog.pot
-Again, there is a shortcut in the :file:`Makefile`:
-
-.. code:: bash
-
- make babel-init LOCALE=nl
-
This will create the directory :file:`fietsboek/locale/{language}`.
Finally, you need to copy the non-gettext messages. This is best done by
@@ -76,6 +70,12 @@ copying over the english original texts:
# Replace nl with the locale that you just generated
cp -r fietsboek/locale/en/html fietsboek/locale/nl/
+Again, there is a shortcut in the :file:`justfile` that does both steps:
+
+.. code:: bash
+
+ just init-language nl
+
Updating a Language
-------------------
@@ -94,7 +94,7 @@ Alternatively, you can also use the shortcut again:
.. code:: bash
- make babel-update LOCALE=nl
+ just update-language nl
Translating
-----------
@@ -125,10 +125,12 @@ Or using the shortcut:
.. code:: bash
- make babel-compile LOCALE=nl
+ just compile-language nl
Further Reading
---------------
* The Pyramid documentation: `Internationalization and Localization
<https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/i18n.html>`__
+
+.. _just: https://github.com/casey/just
diff --git a/justfile b/justfile
index e5625fc..fc29e00 100644
--- a/justfile
+++ b/justfile
@@ -1,4 +1,4 @@
-default:
+_default:
@just --list
# Create a new language pack
@@ -41,3 +41,20 @@ update-language-pack locale:
FB_PATH="$PWD"
cd "language-packs/fietsboek-i18n-{{ locale }}"
pybabel update -d "fietsboek_i18n_{{ locale }}/locale" -l {{ locale }} -i "$FB_PATH/fietsboek/locale/fietslog.pot"
+
+# Initializes a new built-in language
+init-language locale:
+ pybabel init -d fietsboek/locale -l {{ locale }} -i fietsboek/locale/fietslog.pot
+ cp -r fietsboek/locale/en/html fietsboek/locale/{{ locale }}/
+
+# Update the built-in message catalogue
+update-language locale:
+ pybabel update -d fietsboek/locale -l {{ locale }} -i fietsboek/locale/fietslog.pot
+
+# Compile the given built-in language
+compile-language locale:
+ pybabel compile -d fietsboek/locale -l {{ locale }} -i fietsboek/locale/{{ locale }}/LC_MESSAGES/messages.po
+
+# Extract new messages from the source files
+extract-messages:
+ pybabel extract -F babel.cfg -o fietsboek/locale/fietslog.pot --input-dirs=fietsboek