Skip to content

Commit

Permalink
edit the .gitignore, Makefile, and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Amr-Nash committed May 15, 2024
1 parent bdcec87 commit 320548c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Podfile.lock
config_settings.yaml
default_config/

# Additions for specific folders
# Translations ignored files
.venv/
I18N/
*.lproj/
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ create_virtual_env:
rm -rf .venv
python3 -m venv .venv
# TODO: Publish new version on pypi as `python3-localizable`
. .venv/bin/activate && pip install git+https://github.com/Amr-Nash/python-localizable.git
. .venv/bin/activate && pip install openedx-atlas
. .venv/bin/activate && pip install git+https://github.com/Amr-Nash/python-localizable.git@15d3bf2
. .venv/bin/activate && pip install openedx-atlas==0.6.0

pull_translations: clean_translations_temp_directory create_virtual_env
. .venv/bin/activate && atlas pull $(ATLAS_OPTIONS) translations/openedx-app-ios/I18N:I18N
. .venv/bin/activate && python i18n_scripts/translation_script.py --split
. .venv/bin/activate && python i18n_scripts/translation.py --split
make clean_translations_temp_directory


extract_translations: clean_translations_temp_directory create_virtual_env
. .venv/bin/activate && python i18n_scripts/translation_script.py --combine
. .venv/bin/activate && python i18n_scripts/translation.py --combine
63 changes: 45 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,52 @@ Modern vision of the mobile application for the Open edX platform from Raccoon G

6. Click the **Run** button.

## Translation
### How it works for the developer.
- For a developer to translate the App, he/she should, in a normal case, run `make pull_translations` in terminal. This command will do the following:
1. Pull the translations from [openedx translations](https://github.com/openedx/openedx-translations), where the app source translations to the supported languages are.
2. Split those translations each entry to its corresponding module.
3. Remove the pulled files.
## Translations
### Getting translations for the app.
Translations aren't included in the source code of this repository as of [OEP-58](https://docs.openedx.org/en/latest/developers/concepts/oep58.html). Therefore, it needs to be pulled before testing or publishing to App Store.

To get the latest translations for all languages use the following command:
```bash
make pull_translations
```
- Run [`atlas pull`](https://github.com/openedx/openedx-atlas) to download the latest translations file from the [openedx/openedx-translations](https://github.com/openedx/openedx-translations) repository which contains the latest translations for all languages.
- The translations will be pulled into a single file `I18N/uk.lproj/Localization.strings` ([example](https://github.com/openedx/openedx-translations/blob/2737aac533c4e6a621fcf6b9c003ac47ec3bcfcb/translations/openedx-app-ios/I18N/en.lproj/Localizable.strings#L1-L14)).
- The translation file is split into each module e.g. `Discovery/Discovery/uk.lproj/Localization.strings`.
- The `I18N/uk.lproj/Localization.strings` is removed.

then the app would have been translated.

- Now, in the ***testing*** phase, the translations are in `Zeit-Labs/openedx-translations` repo under `fc_55_sample` branch and the tester should use the below command to test:
```
make ATLAS_OPTIONS='--repository=Zeit-Labs/openedx-translations --branch=fc_55_sample' pull_translations
```
### How it works for the translator.
- After a new push to the 'develop' branch, an automated action will do the following:
1. Run `make extract_translations` which will extract the translation entries from the app modules to the single file `I18N/en.lproj/Localization.strings`.
2. Push that file to [openedx translations](https://github.com/openedx/openedx-translations) to be translated later by translators.

- As a side note, the automated github action has not been writen yet.
After this command is run the application can load the translations by changing the device (or the emulator) language in the settings.

#### Using custom translations
runs , which allows to use custom translations with the following options:

By default, the command `make pull_translations` runs [`atlas pull`](https://github.com/openedx/openedx-atlas) which pulls transaltions from the [openedx-translations repository](https://github.com/openedx/openedx-translations).

You can use custom translations on your fork of the openedx-translations repository by setting the following configuration parameters:

- `--revision` (default: `"main"`): Branch or git tag to pull translations from.
- `--repository` (default: `"openedx/openedx-translations"`). GitHub repository slug. There's a feature request to [support GitLab and other providers](https://github.com/openedx/openedx-atlas/issues/20).

Arguments can be passed via the `ATLAS_OPTIONS` environment variable as shown below:
``` bash
make ATLAS_OPTIONS='--repository=<your-github-org>/<repository-name> --revision=<branch-name>' pull_translations
```
There are additional arguments can be passed to `atlas pull`. Refer to the [atlas documentations ](https://github.com/openedx/openedx-atlas) for more information.

#### Testing translations
Until the [pull request #422](https://github.com/openedx/openedx-app-ios/pull/422) is merged, translations needs to be pulled from the testing branch `Zeit-Labs/openedx-translations` repo under `fc_55_sample` branch with the following options:
``` bash
make ATLAS_OPTIONS='--repository=Zeit-Labs/openedx-translations --revision=fc_55_sample' pull_translations
```
### How to translate the app

Translations are managed in the [open-edx/openedx-translations](https://app.transifex.com/open-edx/openedx-translations/dashboard/) Transifex project.

To translate the app join Transifex and add your translations `openedx-app-ios` resource:

- https://app.transifex.com/open-edx/openedx-translations/openedx-app-ios/ (the link will start working after the [pull request #442](https://github.com/openedx/openedx-app-ios/pull/422) is merged)

Once the resource is both 100% translated and reviewed Transifex will push it to the [openedx-translations](https://github.com/openedx/openedx-translations) repository and developers can use the translations in their app.


## API
This project targets on the latest Open edX release and rely on the relevant mobile APIs.
Expand Down
File renamed without changes.

0 comments on commit 320548c

Please sign in to comment.