You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/development/retroarch/new-translations.md
+53-13
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,10 @@ While translation is handled via the Crowdin[^1] platform ([more here](new-trans
7
7
*`msg_hash.c`
8
8
*`msg_hash.h`
9
9
*`retroarch.c`
10
+
*`translation_defines.h`
10
11
*`intl/msg_hash_us.h`
11
12
*`menu/menu_setting.c`
13
+
*`tasks/task_translation.c`
12
14
*`libretro-common/include/libretro.h`
13
15
14
16
> Every new language must first be added to the project on Crowdin. This will ensure that a corresponding `intl/msg_hash_xx.h` file is created. Requests are accepted at the `#retroarch-translations` channel of the RetroArch Discord[^2].
@@ -26,23 +28,18 @@ To add a language with the English name `XXXXX` and two-letter code `xx` (be sur
26
28
2. Open `msg_hash.h`.
27
29
1. Check if a `MENU_ENUM_LABEL_VALUE_LANG_XXXXX` item for your language is present in the `msg_hash_enums` enum; if not, add it.
28
30
3. Open `msg_hash.c`.
29
-
1. Add the following block inside the `msg_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len)` function:
30
-
```c
31
-
case RETRO_LANGUAGE_XXXXX:
32
-
break;
33
-
```
34
-
2. Add the following block inside the `get_user_language_iso639_1(bool limit)` function:
31
+
1. Add the following block inside the `get_user_language_iso639_1(bool limit)` function:
35
32
```c
36
33
case RETRO_LANGUAGE_XXXXX:
37
34
return"xx";
38
35
```
39
-
3. Add the following block inside the `msg_hash_to_str(enum msg_hash_enums msg)` function:
36
+
2. Add the following block inside the `msg_hash_to_str(enum msg_hash_enums msg)` function:
1. Add the following assignment to the `setting_get_string_representation_uint_user_language()` function:
66
+
1. Add the following assignment to the `setting_get_string_representation_uint_user_language()` function, before `if (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) == RETRO_LANGUAGE_ENGLISH)` statement:
2. Add the following block inside the `setting_get_string_representation_uint_ai_service_lang()` function:
71
+
```c
72
+
case TRANSLATION_LANG_XX:
73
+
enum_idx = MENU_ENUM_LABEL_VALUE_LANG_XXXXX;
74
+
break;
72
75
```
73
76
7. Open `retroarch.c`.
74
-
1. Add your language to `enum retro_language rarch_get_language_from_iso(const char *iso639)`:
77
+
1. Add your language to `enum retro_language retroarch_get_language_from_iso(const char *iso639)`:
75
78
```c
76
79
{"xx", RETRO_LANGUAGE_XXXXX},
77
80
```
81
+
8. Open `tasks/task_translation.c`.
82
+
1. Add the following block inside the `ai_service_get_str(enum translation_lang id)` function:
83
+
```c
84
+
case TRANSLATION_LANG_XX:
85
+
return "xx";
86
+
```
87
+
9. Open `translation_defines.h`.
88
+
1. Add your language to the `translation_lang` enum between `TRANSLATION_LANG_DONT_CARE` and `TRANSLATION_LANG_LAST`items:
89
+
```c
90
+
TRANSLATION_LANG_XX, /* Xxxxx */
91
+
```
78
92
79
93
## Optional Adjustments
80
94
@@ -172,6 +186,30 @@ To do that for cores which have been added to Crowdin, follow these steps:
172
186
173
187
> Adding cores to Crowdin is a whole other elaborate process and, currently, can only be performed by a Crowdin manager. Suggestions/Requests can be submitted on Discord to DisasterMo#0389.
174
188
189
+
### Narrator support
190
+
191
+
1. For Mac. (compatible with **say**)
192
+
1. Open `frontend/drivers/platform_darwin.m`.
193
+
2. Go to `accessibility_mac_language_code(const char* language)` function. Check if the following block is present, where `Yyyyy` is the voice name for the language and if not, add it before `return ""`:
194
+
```c
195
+
elseif (string_is_equal(language,"xx"))
196
+
return"Yyyyy";
197
+
```
198
+
2. For Linux. (compatible with **[espeak](https://github.com/espeak-ng/espeak-ng)**)
199
+
1. Open `frontend/drivers/platform_unix.c`.
200
+
2. Go to `accessibility_unix_language_code(const char* language)` function. Check if the following block is present, where `yyy` is the [Identifier](https://github.com/espeak-ng/espeak-ng/blob/master/docs/languages.md) for the language and if not, add it before `/* default voice as fallback */`:
201
+
```c
202
+
elseif (string_is_equal(language, "xx"))
203
+
return"yyy";
204
+
```
205
+
3. For Windows. (OS compatiable)
206
+
1. Open `frontend/drivers/platform_win32.c`.
207
+
2. Go to `accessibility_win_language_code(const char* language)` function. Check if the following block is present, where `Yyyyy` is the [voice name](https://support.microsoft.com/en-us/windows/appendix-a-supported-languages-and-voices-4486e345-7730-53da-fcfe-55cc64300f01#WindowsVersion=Windows_10) for the language and if not, add it before `return ""`:
208
+
```c
209
+
elseif (string_is_equal(language,"xx"))
210
+
return"Microsoft Yyyyy Desktop";
211
+
```
212
+
175
213
## Encoding of translation files
176
214
177
215
Translation files (`intl/msg_hash_xx.h`) in general must be UTF-8 encoded.
@@ -200,6 +238,8 @@ Be careful when creating and editing your new translation files, as some text ed
200
238
* Indonesian, Swedish and Ukrainian (+RGUI):
201
239
*[Add Indonesian, Swedish and Ukrainian language options](https://github.com/libretro/RetroArch/commit/311fec15d9db10ab14c879e898a8205dd37f827c)
202
240
241
+
*[List of merges related to adding languages](https://github.com/libretro/RetroArch/pulls?q=is%3Apr+is%3Amerged+in%3Atitle+add+language+option+)
0 commit comments