1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-03 08:48:42 +00:00

Translation completeness display. (#14779)

Display translation completeness categories in the language selection options.
Generate the progress report for RetroArch menu file instead of all files.
This commit is contained in:
zoltanvb 2022-12-29 22:21:23 +01:00 committed by GitHub
parent 7d81be1d4c
commit 76b3c09ea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 31 deletions

View File

@ -1,4 +1,5 @@
"project_id": "380544" "project_id": "380544"
"main_file_id": "11735"
"api_token": "_secret_" "api_token": "_secret_"
"base_url": "https://api.crowdin.com" "base_url": "https://api.crowdin.com"
"preserve_hierarchy": true "preserve_hierarchy": true

View File

@ -8,7 +8,9 @@ with open("crowdin.yaml", 'r') as config_file:
config = yaml.safe_load(config_file) config = yaml.safe_load(config_file)
headers = { 'Authorization': 'Bearer ' + config['api_token']} headers = { 'Authorization': 'Bearer ' + config['api_token']}
url1 = 'https://api.crowdin.com/api/v2/projects/' + config['project_id'] + '/languages/progress?limit=100' url1 = ('https://api.crowdin.com/api/v2/projects/' + config['project_id'] +
'/files/' + config['main_file_id'] + '/languages/progress?limit=100')
res1 = requests.get(url1, headers=headers) res1 = requests.get(url1, headers=headers)
output = '' output = ''
for lang in res1.json()['data']: for lang in res1.json()['data']:

View File

@ -8830,6 +8830,26 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_LANG_YIDDISH, MENU_ENUM_LABEL_VALUE_LANG_YIDDISH,
"Yiddish - ײִדיש" "Yiddish - ײִדיש"
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_95_PLUS,
">95%"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_75_PLUS,
"75-95%"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_50_PLUS,
"50-74%"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_25_PLUS,
"25-49%"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_25_MINUS,
"<25%"
)
MSG_HASH( /* FIXME Should be MENU_LABEL_VALUE */ MSG_HASH( /* FIXME Should be MENU_LABEL_VALUE */
MSG_UNKNOWN_COMPILER, MSG_UNKNOWN_COMPILER,
"Unknown compiler" "Unknown compiler"

View File

@ -138,6 +138,10 @@
#include "../play_feature_delivery/play_feature_delivery.h" #include "../play_feature_delivery/play_feature_delivery.h"
#endif #endif
#ifdef HAVE_LANGEXTRA
#include "../intl/progress.h"
#endif
#define _3_SECONDS 3000000 #define _3_SECONDS 3000000
#define _6_SECONDS 6000000 #define _6_SECONDS 6000000
#define _9_SECONDS 9000000 #define _9_SECONDS 9000000
@ -6846,40 +6850,71 @@ static void setting_get_string_representation_uint_user_language(
char *s, size_t len) char *s, size_t len)
{ {
const char *modes[RETRO_LANGUAGE_LAST]; const char *modes[RETRO_LANGUAGE_LAST];
uint32_t translated[RETRO_LANGUAGE_LAST];
const char *rating;
#define LANG_DATA(STR) \
modes[RETRO_LANGUAGE_##STR] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_##STR); \
translated[RETRO_LANGUAGE_##STR] = LANGUAGE_PROGRESS_##STR##_TRANSLATED; \
modes[RETRO_LANGUAGE_ENGLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ENGLISH); modes[RETRO_LANGUAGE_ENGLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ENGLISH);
modes[RETRO_LANGUAGE_JAPANESE] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_JAPANESE);
modes[RETRO_LANGUAGE_FRENCH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_FRENCH); LANG_DATA(JAPANESE)
modes[RETRO_LANGUAGE_SPANISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_SPANISH); LANG_DATA(FRENCH)
modes[RETRO_LANGUAGE_GERMAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_GERMAN); LANG_DATA(SPANISH)
modes[RETRO_LANGUAGE_ITALIAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ITALIAN); LANG_DATA(GERMAN)
modes[RETRO_LANGUAGE_DUTCH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_DUTCH); LANG_DATA(ITALIAN)
LANG_DATA(DUTCH)
modes[RETRO_LANGUAGE_PORTUGUESE_BRAZIL] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_BRAZIL); modes[RETRO_LANGUAGE_PORTUGUESE_BRAZIL] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_BRAZIL);
translated[RETRO_LANGUAGE_PORTUGUESE_BRAZIL] = LANGUAGE_PROGRESS_PORTUGUESE_BRAZILIAN_TRANSLATED;
modes[RETRO_LANGUAGE_PORTUGUESE_PORTUGAL] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_PORTUGAL); modes[RETRO_LANGUAGE_PORTUGUESE_PORTUGAL] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_PORTUGAL);
modes[RETRO_LANGUAGE_RUSSIAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_RUSSIAN); translated[RETRO_LANGUAGE_PORTUGUESE_PORTUGAL] = LANGUAGE_PROGRESS_PORTUGUESE_TRANSLATED;
modes[RETRO_LANGUAGE_KOREAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_KOREAN);
modes[RETRO_LANGUAGE_CHINESE_TRADITIONAL] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_CHINESE_TRADITIONAL); LANG_DATA(RUSSIAN)
modes[RETRO_LANGUAGE_CHINESE_SIMPLIFIED] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_CHINESE_SIMPLIFIED); LANG_DATA(KOREAN)
modes[RETRO_LANGUAGE_ESPERANTO] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ESPERANTO); LANG_DATA(CHINESE_TRADITIONAL)
modes[RETRO_LANGUAGE_POLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_POLISH); LANG_DATA(CHINESE_SIMPLIFIED)
modes[RETRO_LANGUAGE_VIETNAMESE] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE); LANG_DATA(ESPERANTO)
modes[RETRO_LANGUAGE_ARABIC] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ARABIC); LANG_DATA(POLISH)
modes[RETRO_LANGUAGE_GREEK] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_GREEK); LANG_DATA(VIETNAMESE)
modes[RETRO_LANGUAGE_TURKISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_TURKISH); LANG_DATA(ARABIC)
modes[RETRO_LANGUAGE_SLOVAK] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_SLOVAK); LANG_DATA(GREEK)
modes[RETRO_LANGUAGE_PERSIAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_PERSIAN); LANG_DATA(TURKISH)
modes[RETRO_LANGUAGE_HEBREW] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_HEBREW); LANG_DATA(SLOVAK)
modes[RETRO_LANGUAGE_ASTURIAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ASTURIAN); LANG_DATA(PERSIAN)
modes[RETRO_LANGUAGE_FINNISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_FINNISH); LANG_DATA(HEBREW)
modes[RETRO_LANGUAGE_INDONESIAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_INDONESIAN); LANG_DATA(ASTURIAN)
modes[RETRO_LANGUAGE_SWEDISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_SWEDISH); LANG_DATA(FINNISH)
modes[RETRO_LANGUAGE_UKRAINIAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_UKRAINIAN); LANG_DATA(INDONESIAN)
modes[RETRO_LANGUAGE_CZECH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_CZECH); LANG_DATA(SWEDISH)
modes[RETRO_LANGUAGE_CATALAN_VALENCIA] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_CATALAN_VALENCIA); LANG_DATA(UKRAINIAN)
modes[RETRO_LANGUAGE_CATALAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_CATALAN); LANG_DATA(CZECH)
modes[RETRO_LANGUAGE_BRITISH_ENGLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_BRITISH_ENGLISH);
modes[RETRO_LANGUAGE_HUNGARIAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_HUNGARIAN); modes[RETRO_LANGUAGE_CATALAN_VALENCIA] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_CATALAN_VALENCIA);
strlcpy(s, modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], len); translated[RETRO_LANGUAGE_CATALAN_VALENCIA] = LANGUAGE_PROGRESS_VALENCIAN_TRANSLATED;
LANG_DATA(CATALAN)
modes[RETRO_LANGUAGE_BRITISH_ENGLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_BRITISH_ENGLISH);
translated[RETRO_LANGUAGE_BRITISH_ENGLISH] = LANGUAGE_PROGRESS_ENGLISH_UNITED_KINGDOM_TRANSLATED;
LANG_DATA(HUNGARIAN)
if (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) == RETRO_LANGUAGE_ENGLISH)
{
snprintf(s, len, "%s",
modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)]);
} else {
rating = msg_hash_to_str(
translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 95 ? MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_95_PLUS :
translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 74 ? MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_75_PLUS :
translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 49 ? MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_50_PLUS :
translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 24 ? MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_25_PLUS :
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_25_MINUS);
snprintf(s, len, "%s [%s]",
modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], rating);
}
} }
#endif #endif

View File

@ -3059,6 +3059,11 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_LANG_CATALAN_VALENCIA, MENU_ENUM_LABEL_VALUE_LANG_CATALAN_VALENCIA,
MENU_ENUM_LABEL_VALUE_LANG_WELSH, MENU_ENUM_LABEL_VALUE_LANG_WELSH,
MENU_ENUM_LABEL_VALUE_LANG_YIDDISH, MENU_ENUM_LABEL_VALUE_LANG_YIDDISH,
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_95_PLUS,
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_75_PLUS,
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_50_PLUS,
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_25_PLUS,
MENU_ENUM_LABEL_VALUE_LANG_COMPLETION_25_MINUS,
MENU_ENUM_LABEL_VALUE_AI_SERVICE_IMAGE_MODE, MENU_ENUM_LABEL_VALUE_AI_SERVICE_IMAGE_MODE,
MENU_ENUM_LABEL_VALUE_AI_SERVICE_SPEECH_MODE, MENU_ENUM_LABEL_VALUE_AI_SERVICE_SPEECH_MODE,
MENU_ENUM_LABEL_VALUE_AI_SERVICE_NARRATOR_MODE, MENU_ENUM_LABEL_VALUE_AI_SERVICE_NARRATOR_MODE,