Synchronize translations

This commit is contained in:
Guo Yunhe 2020-01-04 21:56:06 +02:00
parent 85814137ea
commit 0c2fbd178d
5 changed files with 48 additions and 11 deletions

3
intl/.gitignore vendored
View File

@ -1,2 +1,3 @@
*.json
crowdin.yaml
crowdin.yml

View File

@ -15,3 +15,9 @@
- No performance impact.
- Don't require translators to know how to use Git, how to read C code and how to create Pull Request.
- Translators will be informed whenever a source string changes.
## Cron job setup
1. [Install crowdin cli tool](https://support.crowdin.com/cli-tool/)
2. Get the `intl/crowdin.yaml` file from someone who have crowdin admin accounts
3. Add cron job `cd path/to/retroarch/intl && ./crowin_sync.sh`

27
intl/crowdin_sync.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# Update source code
git pull
# Convert source *.h to *.json
./h2json.py msg_hash_us.h
# Upload source file
crowdin upload sources
# Crowdin need some time to process data
sleep 1m
# Download translation files
crowdin download translations
# Convert translation *.json to *.h
for f in *.json
do
./json2h.py $f
done
# Commit new translations
git add .
git commit -m "Synchronize translations"
git push

View File

@ -14,16 +14,11 @@ except IndexError:
print("Usage: ./template.py <language_postfix>")
sys.exit(1)
p = re.compile('MSG_HASH\(\s*[A-Z0-9_]+,\s*\".*\"\s*\)')
if json_filename == 'msg_hash_us.json':
print("Skip")
sys.exit(0)
header = """#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900)
#if (_MSC_VER >= 1700)
/* https://support.microsoft.com/en-us/kb/980263 */
#pragma execution_character_set("utf-8")
#endif
#pragma warning(disable:4566)
#endif
"""
p = re.compile('MSG_HASH\(\s*[A-Z0-9_]+,\s*\".*\"\s*\)')
def parse_message(message):
@ -53,7 +48,7 @@ def parse_messages(text):
def update(messages, template):
new_translation = header + template
new_translation = template
template_messages = parse_messages(template)
for tp_msg in template_messages:
if tp_msg['key'] in messages:

View File

@ -1,3 +1,11 @@
#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900)
#if (_MSC_VER >= 1700)
/* https://support.microsoft.com/en-us/kb/980263 */
#pragma execution_character_set("utf-8")
#endif
#pragma warning(disable:4566)
#endif
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,