Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ requirements/private.txt
# Translations
*.mo
*.pot
*.po
**/conf/locale/**/LC_MESSAGES/*

# Node.js / npm / yarn / pnpm
node_modules/
Expand Down
85 changes: 15 additions & 70 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
.DEFAULT_GOAL := help

.PHONY: upgrade help requirements quality format test docs
.PHONY: extract_translations compile_translations
.PHONY: detect_changed_source_translations dummy_translations build_dummy_translations
.PHONY: validate_translations pull_translations push_translations install_transifex_clients
.PHONY: extract_translations

REPO_ROOT := $(shell pwd)
SRC_DIR := src
EXTRACT_DIR := conf/locale/en/LC_MESSAGES
# Combined-locale output for the openedx-translations pipeline (OEP-58),
# which expects a single `django.po` source file per repository.
COMBINED_LOCALE_DIR := $(SRC_DIR)/xblocks_core_locale/conf/locale/en/LC_MESSAGES
JS_TARGET := $(SRC_DIR)/xblocks_core_locale/public/js/translations
# XBlock directories: each src/xblock_<name>/ that has its own conf/ subdir
XBLOCKS=$(shell find $(REPO_ROOT)/$(SRC_DIR) -mindepth 2 -maxdepth 2 -type d -name 'conf' -exec dirname {} \;)

help:
@perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'
Expand All @@ -36,76 +33,24 @@ requirements: ## install development environment requirements using uv
uv sync --group dev
uv tool install tox --with tox-uv

# XBlock directories: each src/xblock_<name>/ that has its own conf/ subdir
XBLOCKS=$(shell find $(shell pwd)/$(SRC_DIR) -mindepth 2 -maxdepth 2 -type d -name 'conf' -exec dirname {} \;)

## Localization targets

extract_translations: ## extract strings to be translated, outputting .po files for each XBlock
@for xblock in $(XBLOCKS); do \
echo "Extracting translations for $$xblock..."; \
cd $$xblock && i18n_tool extract --no-segment; \
extract_translations: ## extract strings to be translated, outputting .po files under <module_name>/conf/locale/
@set -e; for xblock in $(XBLOCKS); do \
module_name=$$(basename $$xblock); \
echo "Extracting translations for $$module_name..."; \
cd $$xblock; \
i18n_tool extract --no-segment; \
if [ -f $$xblock/$(EXTRACT_DIR)/djangojs.po ]; then \
cd $$xblock/$(EXTRACT_DIR) && msgcat django.po djangojs.po -o django.po && rm -f djangojs.po; \
msgcat $$xblock/$(EXTRACT_DIR)/django.po $$xblock/$(EXTRACT_DIR)/djangojs.po \
-o $$xblock/$(EXTRACT_DIR)/django.po; \
rm -f $$xblock/$(EXTRACT_DIR)/djangojs.po; \
fi; \
mkdir -p $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR); \
if [ -f $$xblock/$(EXTRACT_DIR)/django.po ]; then \
mv $$xblock/$(EXTRACT_DIR)/django.po $$xblock/$(EXTRACT_DIR)/text.po; \
mv $$xblock/$(EXTRACT_DIR)/django.po $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR)/django.po; \
fi; \
done
@# Merge all per-xblock text.po files into a single combined file for the
@# openedx-translations pipeline (OEP-58), which expects one conf/locale/en per repo.
@mkdir -p $(COMBINED_LOCALE_DIR)
@PO_FILES=""; \
for xblock in $(XBLOCKS); do \
if [ -f $$xblock/$(EXTRACT_DIR)/text.po ]; then \
PO_FILES="$$PO_FILES $$xblock/$(EXTRACT_DIR)/text.po"; \
fi; \
done; \
if [ -n "$$PO_FILES" ]; then \
msgcat --use-first $$PO_FILES -o $(COMBINED_LOCALE_DIR)/django.po; \
echo "Combined translation source file written to $(COMBINED_LOCALE_DIR)/django.po"; \
fi

compile_translations: ## compile translation files, outputting .mo files for each supported language for each XBlock
@for xblock in $(XBLOCKS); do \
echo "Compiling translations for $$xblock..."; \
cd $$xblock && django-admin compilemessages --locale en; \
done

detect_changed_source_translations:
@for xblock in $(XBLOCKS); do \
echo "Detecting changed translations for $$xblock..."; \
cd $$xblock && i18n_tool changed; \
done

dummy_translations: ## generate dummy translation (.po) files for each XBlock
@for xblock in $(XBLOCKS); do \
echo "Generating dummy translations for $$xblock..."; \
cd $$xblock && i18n_tool dummy; \
done

build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files

validate_translations: build_dummy_translations detect_changed_source_translations ## validate translations

pull_translations: ## pull translations from Transifex for each XBlock
@for xblock in $(XBLOCKS); do \
echo "Pulling translations for $$xblock..."; \
cd $$xblock && i18n_tool transifex pull; \
done

push_translations: extract_translations ## push translations to Transifex for each XBlock
@for xblock in $(XBLOCKS); do \
echo "Pushing translations for $$xblock..."; \
cd $$xblock && i18n_tool transifex push; \
done

install_transifex_client: ## Install the Transifex client
# Instaling client will skip CHANGELOG and LICENSE files from git changes
# so remind the user to commit the change first before installing client.
git diff -s --exit-code HEAD || { echo "Please commit changes first."; exit 1; }
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
git checkout -- LICENSE README.md ## overwritten by Transifex installer

selfcheck: ## check that the Makefile is well-formed
@echo "The Makefile is well-formed."
84 changes: 0 additions & 84 deletions src/xblock_annotatable/conf/locale/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,6 @@

locales:
- en # English - Source Language
# - am # Amharic
- ar # Arabic
# - az # Azerbaijani
# - bg_BG # Bulgarian (Bulgaria)
# - bn_BD # Bengali (Bangladesh)
# - bn_IN # Bengali (India)
# - bs # Bosnian
# - ca # Catalan
# - ca@valencia # Catalan (Valencia)
# - cs # Czech
# - cy # Welsh
# - da # Danish
# - de_DE # German (Germany)
# - el # Greek
# - en_GB # English (United Kingdom)
# # Don't pull these until we figure out why pages randomly display in these locales,
# # when the user's browser is in English and the user is not logged in.
# #- en@lolcat # LOLCAT English
# #- en@pirate # Pirate English
- es_419 # Spanish (Latin America)
# - es_AR # Spanish (Argentina)
# - es_EC # Spanish (Ecuador)
# - es_ES # Spanish (Spain)
# - es_MX # Spanish (Mexico)
# - es_PE # Spanish (Peru)
# - et_EE # Estonian (Estonia)
# - eu_ES # Basque (Spain)
# - fa # Persian
# - fa_IR # Persian (Iran)
# - fi_FI # Finnish (Finland)
# - fil # Filipino
- fr # French
# - gl # Galician
# - gu # Gujarati
- he # Hebrew
- hi # Hindi
# - hr # Croatian
# - hu # Hungarian
# - hy_AM # Armenian (Armenia)
# - id # Indonesian
# - it_IT # Italian (Italy)
# - ja_JP # Japanese (Japan)
# - kk_KZ # Kazakh (Kazakhstan)
# - km_KH # Khmer (Cambodia)
# - kn # Kannada
- ko_KR # Korean (Korea)
# - lt_LT # Lithuanian (Lithuania)
# - ml # Malayalam
# - mn # Mongolian
# - mr # Marathi
# - ms # Malay
# - nb # Norwegian Bokmål
# - ne # Nepali
# - nl_NL # Dutch (Netherlands)
# - or # Oriya
# - pl # Polish
- pt_BR # Portuguese (Brazil)
# - pt_PT # Portuguese (Portugal)
# - ro # Romanian
- ru # Russian
# - si # Sinhala
# - sk # Slovak
# - sl # Slovenian
# - sq # Albanian
# - sr # Serbian
# - sv # Swedish
# - sw # Swahili
# - ta # Tamil
# - te # Telugu
# - th # Thai
# - tr_TR # Turkish (Turkey)
# - uk # Ukranian
# - ur # Urdu
# - uz # Uzbek
# - vi # Vietnamese
- zh_CN # Chinese (China)
# - zh_HK # Chinese (Hong Kong)
# - zh_TW # Chinese (Taiwan)


# The locales used for fake-accented English, for testing.
dummy_locales:
- eo
- rtl # Fake testing language for Arabic

# Directories we don't search for strings.
ignore_dirs:
Expand Down
84 changes: 0 additions & 84 deletions src/xblock_discussion/conf/locale/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,6 @@

locales:
- en # English - Source Language
# - am # Amharic
- ar # Arabic
# - az # Azerbaijani
# - bg_BG # Bulgarian (Bulgaria)
# - bn_BD # Bengali (Bangladesh)
# - bn_IN # Bengali (India)
# - bs # Bosnian
# - ca # Catalan
# - ca@valencia # Catalan (Valencia)
# - cs # Czech
# - cy # Welsh
# - da # Danish
# - de_DE # German (Germany)
# - el # Greek
# - en_GB # English (United Kingdom)
# # Don't pull these until we figure out why pages randomly display in these locales,
# # when the user's browser is in English and the user is not logged in.
# #- en@lolcat # LOLCAT English
# #- en@pirate # Pirate English
- es_419 # Spanish (Latin America)
# - es_AR # Spanish (Argentina)
# - es_EC # Spanish (Ecuador)
# - es_ES # Spanish (Spain)
# - es_MX # Spanish (Mexico)
# - es_PE # Spanish (Peru)
# - et_EE # Estonian (Estonia)
# - eu_ES # Basque (Spain)
# - fa # Persian
# - fa_IR # Persian (Iran)
# - fi_FI # Finnish (Finland)
# - fil # Filipino
- fr # French
# - gl # Galician
# - gu # Gujarati
- he # Hebrew
- hi # Hindi
# - hr # Croatian
# - hu # Hungarian
# - hy_AM # Armenian (Armenia)
# - id # Indonesian
# - it_IT # Italian (Italy)
# - ja_JP # Japanese (Japan)
# - kk_KZ # Kazakh (Kazakhstan)
# - km_KH # Khmer (Cambodia)
# - kn # Kannada
- ko_KR # Korean (Korea)
# - lt_LT # Lithuanian (Lithuania)
# - ml # Malayalam
# - mn # Mongolian
# - mr # Marathi
# - ms # Malay
# - nb # Norwegian Bokmål
# - ne # Nepali
# - nl_NL # Dutch (Netherlands)
# - or # Oriya
# - pl # Polish
- pt_BR # Portuguese (Brazil)
# - pt_PT # Portuguese (Portugal)
# - ro # Romanian
- ru # Russian
# - si # Sinhala
# - sk # Slovak
# - sl # Slovenian
# - sq # Albanian
# - sr # Serbian
# - sv # Swedish
# - sw # Swahili
# - ta # Tamil
# - te # Telugu
# - th # Thai
# - tr_TR # Turkish (Turkey)
# - uk # Ukranian
# - ur # Urdu
# - uz # Uzbek
# - vi # Vietnamese
- zh_CN # Chinese (China)
# - zh_HK # Chinese (Hong Kong)
# - zh_TW # Chinese (Taiwan)


# The locales used for fake-accented English, for testing.
dummy_locales:
- eo
- rtl # Fake testing language for Arabic

# Directories we don't search for strings.
ignore_dirs:
Expand Down
84 changes: 0 additions & 84 deletions src/xblock_html/conf/locale/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,6 @@

locales:
- en # English - Source Language
# - am # Amharic
- ar # Arabic
# - az # Azerbaijani
# - bg_BG # Bulgarian (Bulgaria)
# - bn_BD # Bengali (Bangladesh)
# - bn_IN # Bengali (India)
# - bs # Bosnian
# - ca # Catalan
# - ca@valencia # Catalan (Valencia)
# - cs # Czech
# - cy # Welsh
# - da # Danish
# - de_DE # German (Germany)
# - el # Greek
# - en_GB # English (United Kingdom)
# # Don't pull these until we figure out why pages randomly display in these locales,
# # when the user's browser is in English and the user is not logged in.
# #- en@lolcat # LOLCAT English
# #- en@pirate # Pirate English
- es_419 # Spanish (Latin America)
# - es_AR # Spanish (Argentina)
# - es_EC # Spanish (Ecuador)
# - es_ES # Spanish (Spain)
# - es_MX # Spanish (Mexico)
# - es_PE # Spanish (Peru)
# - et_EE # Estonian (Estonia)
# - eu_ES # Basque (Spain)
# - fa # Persian
# - fa_IR # Persian (Iran)
# - fi_FI # Finnish (Finland)
# - fil # Filipino
- fr # French
# - gl # Galician
# - gu # Gujarati
- he # Hebrew
- hi # Hindi
# - hr # Croatian
# - hu # Hungarian
# - hy_AM # Armenian (Armenia)
# - id # Indonesian
# - it_IT # Italian (Italy)
# - ja_JP # Japanese (Japan)
# - kk_KZ # Kazakh (Kazakhstan)
# - km_KH # Khmer (Cambodia)
# - kn # Kannada
- ko_KR # Korean (Korea)
# - lt_LT # Lithuanian (Lithuania)
# - ml # Malayalam
# - mn # Mongolian
# - mr # Marathi
# - ms # Malay
# - nb # Norwegian Bokmål
# - ne # Nepali
# - nl_NL # Dutch (Netherlands)
# - or # Oriya
# - pl # Polish
- pt_BR # Portuguese (Brazil)
# - pt_PT # Portuguese (Portugal)
# - ro # Romanian
- ru # Russian
# - si # Sinhala
# - sk # Slovak
# - sl # Slovenian
# - sq # Albanian
# - sr # Serbian
# - sv # Swedish
# - sw # Swahili
# - ta # Tamil
# - te # Telugu
# - th # Thai
# - tr_TR # Turkish (Turkey)
# - uk # Ukranian
# - ur # Urdu
# - uz # Uzbek
# - vi # Vietnamese
- zh_CN # Chinese (China)
# - zh_HK # Chinese (Hong Kong)
# - zh_TW # Chinese (Taiwan)


# The locales used for fake-accented English, for testing.
dummy_locales:
- eo
- rtl # Fake testing language for Arabic

# Directories we don't search for strings.
ignore_dirs:
Expand Down
Loading
Loading