Skip to content

Commit

Permalink
feat: add translation targets
Browse files Browse the repository at this point in the history
  • Loading branch information
igobranco committed Nov 7, 2023
1 parent 9a63c54 commit d4133f0
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ coverage.xml
cover/

# Translations
*.mo
# *.mo
*.pot

# Django stuff:
Expand Down
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Binary file added locale/en/LC_MESSAGES/django.mo
Binary file not shown.
109 changes: 109 additions & 0 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\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 ""
Binary file added locale/pt_PT/LC_MESSAGES/django.mo
Binary file not shown.
111 changes: 111 additions & 0 deletions locale/pt_PT/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\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"
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block basket_billing_informations %}
<div class="col-md-5 col-sm-12 basket-billing-information-vatin">
<p>{% trans "VATIN" as tmsg %}{{ tmsg | force_escape }}</p>
<p>{% trans "Value-Added Tax Identification Number (VATIN)" as tmsg %}{{ tmsg | force_escape }}</p>

<a href="/payment/nau_extensions/basket-billing-information/vatin/?basket_id={{ basket.id }}">{% trans "Edit" as tmsg %}{{ tmsg | force_escape }}</a>

Expand Down

0 comments on commit d4133f0

Please sign in to comment.