Skip to content

Commit

Permalink
feat!: remove Transifex calls for OEP-58
Browse files Browse the repository at this point in the history
  • Loading branch information
hopewise authored and OmarIthawi committed Mar 17, 2024
1 parent 500ae54 commit 9d4ffd1
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 943 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ coverage
dist/
src/i18n/transifex_input.json
src/data/i18n/default/src/
src/i18n/messages/
temp/babel-plugin-react-intl

## Emacs ###
Expand Down
8 changes: 0 additions & 8 deletions .tx/config

This file was deleted.

31 changes: 6 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
UNAME := $(shell uname)

transifex_langs = "ar,fr,es_419,zh_CN"
i18n = ./src/i18n
transifex_input = $(i18n)/transifex_input.json
i18n = ./src/i18
transifex_utils = ./node_modules/.bin/edx_reactifex

# This directory must match .babelrc .
transifex_temp = ./temp/babel-plugin-react-intl

export TRANSIFEX_RESOURCE = studio-frontend

# Help message borrowed from https://github.com/openedx/devstack, which borrowed it from https://github.com/pydanny/cookiecutter-djangopackage.
help: ## display a help message
@echo $(MAKEFILE_LIST)
Expand Down Expand Up @@ -81,29 +78,13 @@ i18n.concat:
i18n.pre_validate: | i18n.extract i18n.concat
git diff --exit-code $(transifex_input)

# Pushes translations to Transifex. You must run make extract_translations first.
push_translations:

# # Pushing strings to Transifex...
tx push -s

./node_modules/@edx/reactifex/bash_scripts/get_hashed_strings_v3.sh
$$(npm bin)/edx_reactifex $(transifex_temp) --comments --v3-scripts-path
./node_modules/@edx/reactifex/bash_scripts/put_comments_v3.sh

generate_supported_langs: ## generate the currentlySupportedLangs.jsx file
node src/utils/i18n/scripts/generateSupportedLangs.js src/i18n/messages

ifeq ($(OPENEDX_ATLAS_PULL),)
# Pulls translations from Transifex.
pull_translations:
tx pull -t -f --mode reviewed --languages=$(transifex_langs)
else
# Experimental: OEP-58 Pulls translations using atlas
pull_translations:
pull_translations: ## pull translations via atlas for development preview
rm -rf src/i18n/messages
cd src/i18n/ \
&& atlas pull $(ATLAS_OPTIONS) translations/studio-frontend/src/i18n/messages:messages
node src/utils/i18n/scripts/generateSupportedLangs.js src/i18n/messages
endif
atlas pull $(ATLAS_OPTIONS) translations/studio-frontend/src/i18n/messages:src/i18n/messages
make generate_supported_langs

copy-dist:
for f in dist/*; do docker cp $$f edx.devstack.studio:/edx/app/edxapp/edx-platform/node_modules/@edx/studio-frontend/dist/; done
1 change: 0 additions & 1 deletion src/data/i18n/locales

This file was deleted.

176 changes: 0 additions & 176 deletions src/i18n/messages/ar.json

This file was deleted.

55 changes: 36 additions & 19 deletions src/i18n/messages/currentlySupportedLangs.jsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
// This file is generated by the "generateSupportedLangs.js" script.
import arData from 'react-intl/locale-data/ar';
import enData from 'react-intl/locale-data/en';
import daData from 'react-intl/locale-data/da';
import deData from 'react-intl/locale-data/de';
import elData from 'react-intl/locale-data/el';
import esData from 'react-intl/locale-data/es';
import faData from 'react-intl/locale-data/fa';
import frData from 'react-intl/locale-data/fr';
import heData from 'react-intl/locale-data/he';
import hiData from 'react-intl/locale-data/hi';
import idData from 'react-intl/locale-data/id';
import itData from 'react-intl/locale-data/it';
import ptData from 'react-intl/locale-data/pt';
import ruData from 'react-intl/locale-data/ru';
import swData from 'react-intl/locale-data/sw';
import teData from 'react-intl/locale-data/te';
import thData from 'react-intl/locale-data/th';
import trData from 'react-intl/locale-data/tr';
import ukData from 'react-intl/locale-data/uk';
import zhData from 'react-intl/locale-data/zh';

import './ar.json';
import './es_419.json';
import './fr.json';
import './zh_CN.json';

// Methodology: These languages (plus the default english) are the only ones that appear on edx.org
// This was determined by inspecting the 'released_languages' method in the following file:
// https://github.com/openedx/edx-platform/blob/master/openedx/core/djangoapps/lang_pref/api.py
//
// Further, I hit the read replica in order to confirm the live values, which are currently:
// en, fr, zh-cn, es-419, ar
// If these values change, please also update the pull_translations command in Makefile

const localeDataMap = {
export default {
'ar': arData,
'en': enData,
'da': daData,
'de': deData,
'de-de': deData,
'el': elData,
'es-419': esData,
'fr': frData,
'es-es': esData,
'fa': faData,
'fr-ca': frData,
'he': heData,
'hi': hiData,
'id': idData,
'it-it': itData,
'pt-br': ptData,
'pt-pt': ptData,
'ru': ruData,
'sw': swData,
'te': teData,
'th': thData,
'tr-tr': trData,
'uk': ukData,
'zh-cn': zhData,
};

export default localeDataMap;
Loading

0 comments on commit 9d4ffd1

Please sign in to comment.