Add export and import translation scripts

Closes: #430
This commit is contained in:
Terry Yiu 2023-01-29 12:17:01 -05:00 committed by William Casarin
parent 08ca484d54
commit 2ed17a2509
18 changed files with 47 additions and 1259 deletions

View File

@ -91,15 +91,41 @@ damus implements the following [Nostr Implementation Possibilities][nips]
## Contributing
Contributors welcome! [Email patches][git-send-email] to jb55@jb55.com are preferred, but I accept PRs on github as well.
Contributors welcome!
### Code
[Email patches][git-send-email] to jb55@jb55.com are preferred, but I accept PRs on GitHub as well.
[git-send-email]: http://git-send-email.io
## git log bot
### Translations
npub1fjtdwclt9lspjy8huu3qklr7eklp5uq90u6yh8mec290pqxraccqlufnas
Translators welcome! Join the [Transifex][transifex] project.
### Awards
All user-facing strings must have a comment in order to provide context to translators. If a SwiftUI component has a `comment` parameter, use that. Otherwise, wrap your string with `NSLocalizedString` with the `comment` field populated.
[transifex]: https://explore.transifex.com/damus/damus-ios/
#### Export Source Translations
If user-facing strings have been added or changed, please export them for translation as part of your pull request or commit by running:
```zsh
./devtools/export-source-translation.sh
```
This command will export source translations to `translations/en-US.xcloc/Localized Contents/en-US.xliff`, which the Transifex integration will read from the `master` branch and allow translators to translate those strings.
#### Import Translations
Once 100% of strings have been translated for a given locale, Transifex will open up a pull request with the `translations/<locale>.xliff` file changed. Currently, it must be manually imported into the project before merging the pull request by running:
```zsh
./devtools/import-translation.sh <locale_code_in_snake_case>
```
### Awards
There may be nostr badges awarded for contributors in the future... :)
@ -107,3 +133,7 @@ First contributors:
1. @randymcmillan
2. @jcarucci27
### git log bot
npub1fjtdwclt9lspjy8huu3qklr7eklp5uq90u6yh8mec290pqxraccqlufnas

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
#!/bin/zsh
xcodebuild -exportLocalizations -project damus.xcodeproj -localizationPath "translations" -exportLanguage en-US

8
devtools/import-translation.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/zsh
if [ -z "$*" ]; then
echo "Usage: ./devtools/import-translation.sh <locale_code_in_snake_case>"
return
fi
find "translations" -name "${1}.xliff" | grep -v "en-US.xliff" | xargs -I % xcodebuild -importLocalizations -project damus.xcodeproj -localizationPath %

View File

@ -3,8 +3,8 @@ git:
- filter_type: file
file_format: XLIFF
source_language: en_US
source_file: damus Localizations/en-US.xcloc/Localized Contents/en-US.xliff
translation_files_expression: damus Localizations/<lang>.xcloc/Localized Contents/<lang>.xliff
source_file: translations/en-US.xcloc/Localized Contents/en-US.xliff
translation_files_expression: translations/<lang>.xliff
settings:
pr_branch_name: transifex/<br_unique_id>