From d4133f037e0d736102082974cf417e98a63d4545 Mon Sep 17 00:00:00 2001 From: Ivo Branco Date: Tue, 7 Nov 2023 14:53:59 +0000 Subject: [PATCH] feat: add translation targets --- .github/workflows/ci.yml | 3 + .gitignore | 2 +- Makefile | 26 +++- locale/en/LC_MESSAGES/django.mo | Bin 0 -> 380 bytes locale/en/LC_MESSAGES/django.po | 109 +++++++++++++++++ locale/pt_PT/LC_MESSAGES/django.mo | Bin 0 -> 1719 bytes locale/pt_PT/LC_MESSAGES/django.po | 111 ++++++++++++++++++ .../checkout/checkout_partial.html | 2 +- 8 files changed, 246 insertions(+), 7 deletions(-) create mode 100644 locale/en/LC_MESSAGES/django.mo create mode 100644 locale/en/LC_MESSAGES/django.po create mode 100644 locale/pt_PT/LC_MESSAGES/django.mo create mode 100644 locale/pt_PT/LC_MESSAGES/django.po diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e900f1..373fe9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,3 +46,6 @@ jobs: - name: Run lint run: ECOMMERCE_SOURCE_PATH=../ecommerce make -C ecommerce-nau-extensions lint + + - name: Extract translations and detect changed source translations + run: make -C ecommerce-nau-extensions extract_translations detect_changed_source_translations diff --git a/.gitignore b/.gitignore index 695f7c5..eea0fc3 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,7 @@ coverage.xml cover/ # Translations -*.mo +# *.mo *.pot # Django stuff: diff --git a/Makefile b/Makefile index fcaa21d..a068980 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) ECOMMERCE_SOURCE_PATH ?= /edx/app/ecommerce/ecommerce SRC_FOLDER_RELATIVE_PATH ?= nau_extensions SRC_FOLDER_FULL_PATH=$(ROOT_DIR)/$(SRC_FOLDER_RELATIVE_PATH) +LOCALES=--locale en --locale pt_PT # ============================================================================== # RULES @@ -46,28 +47,43 @@ clean: ## remove all the unneeded artifacts .PHONY: clean # It will use the `.isort.cfg` from ecommerce -lint-isort: _prerequire +lint_isort: _prerequire @cd ${ECOMMERCE_SOURCE_PATH} && \ isort --check-only --diff $(SRC_FOLDER_FULL_PATH) .PHONY: lint-isort # It will use the `.isort.cfg` from ecommerce -run-isort: _prerequire +run_isort: _prerequire ## Run the isort to sort the python imports @cd ${ECOMMERCE_SOURCE_PATH} && \ isort $(SRC_FOLDER_FULL_PATH) .PHONY: run_isort # It will use the `setup.cfg` from ecommerce -lint-pycodestyle: _prerequire +lint_pycodestyle: _prerequire @cd ${ECOMMERCE_SOURCE_PATH} && \ pycodestyle --config=setup.cfg $(SRC_FOLDER_FULL_PATH) .PHONY: lint-pycodestyle # It will use the `pylintrc` from ecommerce -lint-pylint: _prerequire +lint_pylint: _prerequire @cd ${ECOMMERCE_SOURCE_PATH} && \ pylint -j 0 --rcfile=pylintrc --verbose --init-hook='import sys; sys.path.append("${ECOMMERCE_SOURCE_PATH}")' $(SRC_FOLDER_FULL_PATH) .PHONY: lint-pylint -lint: | lint-isort lint-pycodestyle lint-pylint ## Run Python linting +lint: | lint_isort lint_pycodestyle lint_pylint ## Run Python linting .PHONY: lint + +extract_translations: ## Extract translations from source code + @python ${ECOMMERCE_SOURCE_PATH}/manage.py makemessages $(LOCALES) -d django +.PHONY: extract-translations + +compile_translations: ## Compiles the extracted transactions + @python ${ECOMMERCE_SOURCE_PATH}/manage.py compilemessages +.PHONY: compile_translations + +detect_changed_source_translations: + @test $$(git diff --exit-code -G "^(msgid|msgstr)" | wc -l) -eq 0 || ( echo "Detected a changed source transactions!" ; exit 1 ) +.PHONY: detect_changed_source_translations + +transactions: | extract_translations compile_translations ## Extract and compile translations +.PHONY: transactions diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..71cbdf3e9d8d54be31066ec4ad8628bc2c1f2845 GIT binary patch literal 380 zcmYL@K~KUk7=|%=+R?Lz&%}d9i{c3jGZa>EvE7z2Nc2{r&Y96JZ6W$Y{CoZuJ5A(G zp7i_Dx9RhJeDu}vIq;l#&OC>nD^HugXY4QU{MmN?lNtRkR}RH%w3NnHT4Bh@vF%H^(V-=Ii1iQ$Qo9Pt!I1Rhe%oml#`f^NEGFCKEL->Rc=KoQ6a?!10%_7(V7ey8`V`;n{war z20Z3;uifk31QV^CRQ|iq#``$=;jWunRB8aLH({)F;i8zL{=V00y-I_qTIqGAN(}v% i$^}`yHKImSZ8jEzYJOK6-VWez49^vuhS0kh1f3tbb!oc* literal 0 HcmV?d00001 diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po new file mode 100644 index 0000000..be294b5 --- /dev/null +++ b/locale/en/LC_MESSAGES/django.po @@ -0,0 +1,109 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-11-07 14:48+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: nau_extensions/models.py:37 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:21 +msgid "VAT Identification Number (VATIN)" +msgstr "" + +#: nau_extensions/models.py:41 +msgid "" +"The value-added tax identification number or VAT identification number can " +"be used to identify a business or a taxable person in the European Union." +msgstr "" + +#: nau_extensions/models.py:48 +msgid "Basket Billing Information" +msgstr "" + +#: nau_extensions/models.py:49 +msgid "Basket Billing Informations" +msgstr "" + +#: nau_extensions/models.py:69 +msgid "Incorrect vatin format for country" +msgstr "" + +#: nau_extensions/models.py:92 +msgid "To be sent" +msgstr "" + +#: nau_extensions/models.py:93 +msgid "Sent with success" +msgstr "" + +#: nau_extensions/models.py:94 +msgid "Sent with error" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:9 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:21 +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:32 +msgid "Billing address" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:39 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:39 +msgid "Saving..." +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:39 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:39 +msgid "Save" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:40 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:40 +msgid "or" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:40 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:40 +msgid "cancel" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:9 +msgid "Billing information" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:12 +msgid "Value-Added Tax Identification Number (VATIN)" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:14 +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:34 +msgid "Edit" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:20 +msgid "Country" +msgstr "" + +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:22 +msgid "VATIN" +msgstr "" + +#: nau_extensions/views.py:151 +msgid "Address saved" +msgstr "" + +#: nau_extensions/views.py:189 +msgid "VATIN saved" +msgstr "" diff --git a/locale/pt_PT/LC_MESSAGES/django.mo b/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..367d3dd6bb9a7e423935514cf9658748541a6170 GIT binary patch literal 1719 zcmb7@zmFS56vu}Uewp710>m#pAp}9un$Sf~K-s%nA1nOhWcw@yXvVu^-(1!+*37Jl zp#xD+qze_IqDX;|D4;=fZYiKff|`GUitk(7_yP)2Mw-125bw#C_l;@L@0pBd`tL4}J{7RD1$H0}Y>nXR!YYL0Q*#Am{Nj z_$>J6`uiz3Wxp?BVLz{cuYu=5*4+mm0pACo0FOY}NALcdj*#t2k`S_jqu9HiL6w|C_dFFcT9r3n&I zusnCld-8IwaY?kt->%UTif*^NMM1Edc7|C$^`mQha*zXS$AUZ%Pd0%VsND3tteFl87ikB zuanMkO^^VSfO z2oR8z&dwBE92yj@E(VsJd8iNwnRZs|y4u4^E&c#P4WKr?U2SKj_FQ%Gbpc_SDg<&r zaP}Cri_$zAB02&!=pf#GH{MTZnDqK-w^Qq>nROv*`-#q@opR!%fo)Ljpd0nnT=Si1 zPX^VXt4Z98+TCa`rgyrHc6$E3ZYQa=qz}=+N#hF{tZPv7u+^eY+)n6n(vH*Cm3VKj zm-PE@!_-VlIZ@F-$!UXHacBRKm0WJMt`xd%-DGP61?{w*Y-PV$zfjw?CZIskU@?Q9 zpst5EW`)$|5@koyc@^F|95kbgTRWCDRxV1=MLGJTK^I3l)I?%(<<#<)B?xl4%q<$N zYOUq1<=2*SMPnICC#&s=vmccI_u#GizPBg2hQ$=Md9xYNeJ(_AJ zog@aE?^jx#h}Wtew|ipd8kg`Ird7k=_5mG_HngHkX8Ge(xhlrC)mO<@G1OS;fY8W6 zPiNL6wzngv5FAg1`#8hv&rp31X3M*Am=0r_S$Ot%Qf1JE{)nAaakpY{G?k>LGsHp8 zCAQ?tW0nO|@Acf0k^Efv53Qb$mUUD^aS5F0q)ndNU)tH`ynQgMoSWKbvY>OY-@F%i Hu%-ALvRdE| literal 0 HcmV?d00001 diff --git a/locale/pt_PT/LC_MESSAGES/django.po b/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 0000000..4d29447 --- /dev/null +++ b/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,111 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-11-07 14:48+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: nau_extensions/models.py:37 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:21 +msgid "VAT Identification Number (VATIN)" +msgstr "" + +#: nau_extensions/models.py:41 +msgid "" +"The value-added tax identification number or VAT identification number can " +"be used to identify a business or a taxable person in the European Union." +msgstr "" +"O número de identificação para efeitos de imposto sobre o valor acrescentado " +"ou número de identificação para efeitos de IVA pode ser utilizado para " +"identificar uma empresa ou um sujeito passivo na União Europeia." + +#: nau_extensions/models.py:48 +msgid "Basket Billing Information" +msgstr "Informação de faturação" + +#: nau_extensions/models.py:49 +msgid "Basket Billing Informations" +msgstr "Informações de faturação" + +#: nau_extensions/models.py:69 +msgid "Incorrect vatin format for country" +msgstr "Formato de dados incorreto para o país" + +#: nau_extensions/models.py:92 +msgid "To be sent" +msgstr "A enviar" + +#: nau_extensions/models.py:93 +msgid "Sent with success" +msgstr "Enviado com sucesso" + +#: nau_extensions/models.py:94 +msgid "Sent with error" +msgstr "Enviado com erro" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:9 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:21 +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:32 +msgid "Billing address" +msgstr "Endereço de faturação" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:39 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:39 +msgid "Saving..." +msgstr "A guardar..." + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:39 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:39 +msgid "Save" +msgstr "Guardar" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:40 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:40 +msgid "or" +msgstr "ou" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/address.html:40 +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:40 +msgid "cancel" +msgstr "cancelar" + +#: nau_extensions/templates/nau_extensions/checkout/basket_billing_information/vatin.html:9 +msgid "Billing information" +msgstr "Informação de faturação" + +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:12 +msgid "Value-Added Tax Identification Number (VATIN)" +msgstr "Número de Identificação Fiscal (NIF)" + +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:14 +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:34 +msgid "Edit" +msgstr "Editar" + +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:20 +msgid "Country" +msgstr "País" + +#: nau_extensions/templates/nau_extensions/checkout/checkout_partial.html:22 +msgid "VATIN" +msgstr "NIF" + +#: nau_extensions/views.py:151 +msgid "Address saved" +msgstr "Endereço guardado" + +#: nau_extensions/views.py:189 +msgid "VATIN saved" +msgstr "NIF guardado" diff --git a/nau_extensions/templates/nau_extensions/checkout/checkout_partial.html b/nau_extensions/templates/nau_extensions/checkout/checkout_partial.html index 81abeea..48e8421 100644 --- a/nau_extensions/templates/nau_extensions/checkout/checkout_partial.html +++ b/nau_extensions/templates/nau_extensions/checkout/checkout_partial.html @@ -9,7 +9,7 @@ {% block basket_billing_informations %}
-

{% trans "VATIN" as tmsg %}{{ tmsg | force_escape }}

+

{% trans "Value-Added Tax Identification Number (VATIN)" as tmsg %}{{ tmsg | force_escape }}

{% trans "Edit" as tmsg %}{{ tmsg | force_escape }}