Spaces:
Paused
Paused
rick
commited on
start the dream...
Browse files
scripts/gen_ui_lang_support.py
CHANGED
|
@@ -19,6 +19,9 @@ SUPPORTED_LANGUAGES_FR_ = [
|
|
| 19 |
"Afrikaans", "Arabe", "Arménien", "Azéri", "Biélorusse", "Bosniaque", "Bulgare", "Catalan", "Chinois", "Croate", "Tchèque", "Danois", "Néerlandais", "Anglais", "Estonien", "Finnois", "Français", "Galicien", "Allemand", "Grec", "Hébreu", "Hindi", "Hongrois", "Islandais", "Indonésien", "Italien", "Japonais", "Kannada", "Kazakh", "Coréen", "Letton", "Lituanien", "Macédonien", "Malais", "Marathi", "Maori", "Népalais", "Norvégien", "Persan", "Polonais", "Portugais", "Roumain", "Russe", "Serbe", "Slovaque", "Slovène", "Espagnol", "Swahili", "Suédois", "Tagalog", "Tamoul", "Thaï", "Turc", "Ukrainien", "Ourdou", "Vietnamien", "Gallois"
|
| 20 |
]
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
traductions_ui_dict = {
|
| 23 |
"Français": {
|
| 24 |
"titre": "------- DEMORRHA -------",
|
|
@@ -149,17 +152,19 @@ def generate_ui_lang_support(
|
|
| 149 |
traduction_text_ui = create_chat_completion(openai_client, PROMPT_, text_ui)
|
| 150 |
traductions_ui_dict[to_lang][key] = traduction_text_ui
|
| 151 |
|
| 152 |
-
return json.dumps(traductions_ui_dict, indent=4, sort_keys=False)
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
if __name__ == "__main__":
|
| 157 |
JSON_UI_LANG_SUPPORT = generate_ui_lang_support(
|
| 158 |
base_ui_lang="Français",
|
| 159 |
-
target_ui_lang=SUPPORTED_LANGUAGES_FR_
|
| 160 |
)
|
|
|
|
|
|
|
| 161 |
if type(JSON_UI_LANG_SUPPORT) == str:
|
| 162 |
-
JSON_UI_LANG_SUPPORT.encode()
|
| 163 |
|
| 164 |
# timestamp string format : "MM-DD-YYYY_HH-MM-SS"
|
| 165 |
timestamp = datetime.datetime.now().strftime("%m-%d-%Y_%H-%M-%S")
|
|
|
|
| 19 |
"Afrikaans", "Arabe", "Arménien", "Azéri", "Biélorusse", "Bosniaque", "Bulgare", "Catalan", "Chinois", "Croate", "Tchèque", "Danois", "Néerlandais", "Anglais", "Estonien", "Finnois", "Français", "Galicien", "Allemand", "Grec", "Hébreu", "Hindi", "Hongrois", "Islandais", "Indonésien", "Italien", "Japonais", "Kannada", "Kazakh", "Coréen", "Letton", "Lituanien", "Macédonien", "Malais", "Marathi", "Maori", "Népalais", "Norvégien", "Persan", "Polonais", "Portugais", "Roumain", "Russe", "Serbe", "Slovaque", "Slovène", "Espagnol", "Swahili", "Suédois", "Tagalog", "Tamoul", "Thaï", "Turc", "Ukrainien", "Ourdou", "Vietnamien", "Gallois"
|
| 20 |
]
|
| 21 |
|
| 22 |
+
|
| 23 |
+
LANG__ = [ "English" ]
|
| 24 |
+
|
| 25 |
traductions_ui_dict = {
|
| 26 |
"Français": {
|
| 27 |
"titre": "------- DEMORRHA -------",
|
|
|
|
| 152 |
traduction_text_ui = create_chat_completion(openai_client, PROMPT_, text_ui)
|
| 153 |
traductions_ui_dict[to_lang][key] = traduction_text_ui
|
| 154 |
|
| 155 |
+
return json.dumps(traductions_ui_dict, indent=4, ensure_ascii=False, sort_keys=False)
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
if __name__ == "__main__":
|
| 160 |
JSON_UI_LANG_SUPPORT = generate_ui_lang_support(
|
| 161 |
base_ui_lang="Français",
|
| 162 |
+
target_ui_lang=LANG__ #SUPPORTED_LANGUAGES_FR_
|
| 163 |
)
|
| 164 |
+
|
| 165 |
+
# encoding , fr_FR.UTF-8
|
| 166 |
if type(JSON_UI_LANG_SUPPORT) == str:
|
| 167 |
+
JSON_UI_LANG_SUPPORT = JSON_UI_LANG_SUPPORT.encode("utf-8")
|
| 168 |
|
| 169 |
# timestamp string format : "MM-DD-YYYY_HH-MM-SS"
|
| 170 |
timestamp = datetime.datetime.now().strftime("%m-%d-%Y_%H-%M-%S")
|