Skip to content

Commit

Permalink
Fix some translations and load correct fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpl0itU committed Oct 23, 2022
1 parent 4f3de27 commit c82b013
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 27 deletions.
1 change: 1 addition & 0 deletions include/log_freetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#endif

bool WHBLogFreetypeInit() __attribute__((cold));
bool setFont(OSSharedDataType font);
void WHBLogFreetypeFree() __attribute__((cold));
void drawPixel(int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
void ttfFontColor32(uint32_t color);
Expand Down
26 changes: 13 additions & 13 deletions languages/italian.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
" Backup All (%u Title%s)": " Backup di tutto (%u titolo%s)",
" Backup Wii U (%u Title%s)": " Backup Wii U (%u Titolo%s)",
" Backup vWii (%u Title%s)": " Backup vWii (%u Titolo%s)",
"\ue000: Backup \ue001: Back": "\ue000: Backup <unk>: Indietro",
"\ue000: Backup \ue001: Back": "\ue000: Backup \ue001: Indietro",
"%s Sort: %s \ue084": "%s Ordinamento: %s \ue084",
" [Not Init]": " [Non Init]",
"\ue000: Select Game \ue001: Back": "\ue000: Seleziona Partita \ue001:Indietro",
"\ue000: Select Game \ue001: Back": "\ue000: Seleziona Partita \ue001: Indietro",
" Backup savedata": " Backup salvataggio",
" Restore savedata": " Ripristina salvataggio",
" Wipe savedata": " Pulisci salvataggio",
Expand All @@ -44,15 +44,15 @@
" to copy from": " per copiare da",
" to copy to": " per copiare su",
"Date: %s": "Data: %s",
"Include 'common' save?": "Includi salvataggio 'comuni'?",
"Include 'common' save?": "Includi salvataggio 'common'?",
"yes": "",
"no ": "no ",
"No 'common' save found.": "Nessun salvataggio 'comune' trovato.",
"\ue000: Restore \ue001: Back": "\ue000: Ripristina \ue001: Indietro",
"\ue000: Wipe \ue001: Back": "\ue000: Pulire \ue001:Indietro",
"\ue000: Import \ue001: Back": "\ue000: Importa \ue001:Indietro",
"\ue000: Export \ue001: Back": "\ue000: Esporta \ue001:Indietro",
"\ue000: Copy \ue001: Back": "\ue000: Copia \ue001:Indietro",
"\ue000: Wipe \ue001: Back": "\ue000: Pulire \ue001: Indietro",
"\ue000: Import \ue001: Back": "\ue000: Importa \ue001: Indietro",
"\ue000: Export \ue001: Back": "\ue000: Esporta \ue001: Indietro",
"\ue000: Copy \ue001: Back": "\ue000: Copia \ue001: Indietro",
"Press \ue044 to exit.": "Premi \ue044 per uscire.",
"No Wii U titles found.": "Nessun titolo Wii U trovato.",
"No vWii saves found.": "Nessun salvataggio vWii trovato.",
Expand All @@ -70,11 +70,11 @@
"\ue000 Yes - \ue001 No": "\ue000 Sì - \ue001 No",
"\ue000 Confirm - \ue001 Cancel": "\ue000 Conferma - \ue001 Annulla",
"Filesize: %d bytes": "Dimensione file: %d byte",
"Deleting folder %s": "Eliminazione cartella '%s'",
"From: \n%s": "Da: %s",
"Failed to delete folder %s\n%s": "Non è stato possibile eliminare il file %s %s",
"Deleting file %s": "Eliminazione cartella '%s'",
"Failed to delete file %s\n%s": "Non è stato possibile eliminare il file %s %s",
"Deleting folder %s": "Eliminazione cartella %s",
"From: \n%s": "Da: \n%s",
"Failed to delete folder %s\n%s": "Non è stato possibile eliminare il file %s\n%s",
"Deleting file %s": "Eliminazione cartella %s",
"Failed to delete file %s\n%s": "Non è stato possibile eliminare il file %s\n%s",
"Loadiine game folder not found.": "Cartella di gioco Loadiine non trovata.",
"Failed to open Loadiine game save directory.": "Apertura della directory di salvataggio del gioco Loadiine non riuscita.",
"Are you sure?": "Sei sicuro?",
Expand All @@ -92,7 +92,7 @@
"Backup current savedata first?": "Salvare prima il salvataggio corrente?",
"Failed to delete common folder.\n%s": "Impossibile eliminare la cartella comune.\n%s",
"Failed to delete savefile.": "Non è stato possibile eliminare il salvataggio.",
"Failed to delete user folder.\n%s": "Impossibile eliminare la cartella. %s",
"Failed to delete user folder.\n%s": "Impossibile eliminare la cartella.\n%s",
"Failed to import savedata from loadiine.": "Impossibile importare salvataggi da loadiine.",
"Failed to export savedata to loadiine.": "Impossibile importare salvataggi da loadiine."
}
28 changes: 14 additions & 14 deletions languages/japanese.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
"Storage": "ストレージ",
"Storage+Name": "ストレージ+名前",
"initFS failed. Please make sure your MochaPayload is up-to-date": "initFS が失敗しました。 MochaPayload が最新であることを確認してください",
" Wii U Save Management (%u Title%s)": "Wii U セーブ管理 (%u タイトル%s)",
" vWii Save Management (%u Title%s)": "vWii セーブ管理 (%u タイトル%s)",
" Batch Backup": "バッチバックアップ",
" Wii U Save Management (%u Title%s)": " Wii U セーブ管理 (%u タイトル%s)",
" vWii Save Management (%u Title%s)": " vWii セーブ管理 (%u タイトル%s)",
" Batch Backup": " バッチバックアップ",
"\uE002: Options \ue000: Select Mode": "\uE002: オプション \ue000: モードの選択",
" Backup All (%u Title%s)": "すべてバックアップ (%u タイトル%s)",
" Backup Wii U (%u Title%s)": "バックアップ Wii U (%u タイトル%s)",
" Backup vWii (%u Title%s)": "バックアップ vWii (%u タイトル%s)",
" Backup All (%u Title%s)": " すべてバックアップ (%u タイトル%s)",
" Backup Wii U (%u Title%s)": " バックアップ Wii U (%u タイトル%s)",
" Backup vWii (%u Title%s)": " バックアップ vWii (%u タイトル%s)",
"\ue000: Backup \ue001: Back": "\ue000: バックアップ \ue001: 戻る",
"%s Sort: %s \ue084": "%s 並べ替え: %s \ue084",
" [Not Init]": "[初期化しない]",
"\ue000: Select Game \ue001: Back": "\ue000: ゲームを選択 \ue001: 戻る",
" Backup savedata": "セーブデータのバックアップ",
" Restore savedata": "セーブデータの復元",
" Wipe savedata": "セーブデータを消去",
" Import from loadiine": "ローディーンからインポート",
" Export to loadiine": "ローディーンにエクスポート",
" Copy Savedata to Title in %s": "セーブデータを %s のタイトルにコピー",
" Backup savedata": " セーブデータのバックアップ",
" Restore savedata": " セーブデータの復元",
" Wipe savedata": " セーブデータを消去",
" Import from loadiine": " ローディーンからインポート",
" Export to loadiine": " ローディーンにエクスポート",
" Copy Savedata to Title in %s": " セーブデータを %s のタイトルにコピー",
"\ue000: Select Task \ue001: Back": "\ue000: タスクを選択 \ue001: 戻る",
"Destination:": "行き先:",
"Select %s:": "%s を選択:",
Expand All @@ -41,8 +41,8 @@
"Has Save": "保存あり",
"Select Wii U user to delete from:": "削除するWii Uユーザーを選択:",
"Select Wii U user%s:": "Wii Uユーザー%sを選択:",
" to copy from": "からコピーする",
" to copy to": "コピーする",
" to copy from": " からコピーする",
" to copy to": " コピーする",
"Date: %s": "日付: %s",
"Include 'common' save?": "「共通」保存を含めますか?",
"yes": "はい",
Expand Down
10 changes: 10 additions & 0 deletions src/language.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "log_freetype.h"
#include <cstdio>
#include <language.h>
#include <savemng.h>
Expand Down Expand Up @@ -27,9 +28,11 @@ void loadLanguage(Swkbd_LanguageType language) {
loadedLang = language;
switch (language) {
case Swkbd_LanguageType__Japanese:
setFont(OS_SHAREDDATATYPE_FONT_STANDARD);
gettextLoadLanguage("romfs:/japanese.json");
break;
case Swkbd_LanguageType__English:
setFont(OS_SHAREDDATATYPE_FONT_STANDARD);
gettextLoadLanguage("romfs:/english.json");
break;
/*case Swkbd_LanguageType__French:
Expand All @@ -39,15 +42,19 @@ void loadLanguage(Swkbd_LanguageType language) {
gettextLoadLanguage("romfs:/german.json");
break;*/
case Swkbd_LanguageType__Italian:
setFont(OS_SHAREDDATATYPE_FONT_STANDARD);
gettextLoadLanguage("romfs:/italian.json");
break;
case Swkbd_LanguageType__Spanish:
setFont(OS_SHAREDDATATYPE_FONT_STANDARD);
gettextLoadLanguage("romfs:/spanish.json");
break;
case Swkbd_LanguageType__Chinese1:
setFont(OS_SHAREDDATATYPE_FONT_CHINESE);
gettextLoadLanguage("romfs:/TChinese.json");
break;
case Swkbd_LanguageType__Korean:
setFont(OS_SHAREDDATATYPE_FONT_KOREAN);
gettextLoadLanguage("romfs:/korean.json");
break;
/*
Expand All @@ -58,12 +65,15 @@ void loadLanguage(Swkbd_LanguageType language) {
gettextLoadLanguage("romfs:/portuguese.json");
break;*/
case Swkbd_LanguageType__Russian:
setFont(OS_SHAREDDATATYPE_FONT_STANDARD);
gettextLoadLanguage("romfs:/russian.json");
break;
case Swkbd_LanguageType__Chinese2:
setFont(OS_SHAREDDATATYPE_FONT_CHINESE);
gettextLoadLanguage("romfs:/SChinese.json");
break;
default:
setFont(OS_SHAREDDATATYPE_FONT_STANDARD);
gettextLoadLanguage("romfs:/english.json");
break;
}
Expand Down
17 changes: 17 additions & 0 deletions src/log_freetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ bool WHBLogFreetypeInit() {
return false;
}

bool setFont(OSSharedDataType font) {
FT_Error result;
if ((result = FT_Init_FreeType(&fontLibrary)) != 0)
return true;

uint32_t fontSize;
OSGetSharedData(font, 0, (void **) &fontBuffer, &fontSize);

if ((result = FT_New_Memory_Face(fontLibrary, fontBuffer, fontSize, 0, &fontFace)) != 0)
return true;
if ((result = FT_Select_Charmap(fontFace, FT_ENCODING_UNICODE)) != 0)
return true;
if ((result = FT_Set_Pixel_Sizes(fontFace, 0, 22)))
return true;
return false;
}

void WHBLogFreetypeFree() {
FT_Done_Face(fontFace);
FT_Done_FreeType(fontLibrary);
Expand Down

0 comments on commit c82b013

Please sign in to comment.