VitaShell/language.c

247 lines
7.3 KiB
C
Raw Normal View History

2016-08-06 06:59:41 +00:00
/*
VitaShell
2017-01-12 16:45:52 +00:00
Copyright (C) 2015-2017, TheFloW
2016-08-06 06:59:41 +00:00
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
#include "config.h"
2016-08-06 06:59:41 +00:00
#include "language.h"
INCLUDE_EXTERN_RESOURCE(english_us_txt);
2016-08-06 06:59:41 +00:00
static char *lang[] ={
"japanese",
"english_us",
"french",
"spanish",
"german",
"italian",
"dutch",
"portuguese",
"russian",
"korean",
"chinese_t",
"chinese_s",
"finnish",
"swedish",
"danish",
"norwegian",
"polish",
"portuguese_br",
"turkish"
2016-08-06 06:59:41 +00:00
};
char *language_container[LANGUAGE_CONTRAINER_SIZE];
void freeLanguageContainer() {
int i;
for (i = 0; i < LANGUAGE_CONTRAINER_SIZE; i++) {
if (language_container[i]) {
free(language_container[i]);
language_container[i] = NULL;
}
}
}
void loadLanguage(int id) {
2016-08-06 06:59:41 +00:00
freeLanguageContainer();
2016-08-27 10:49:03 +00:00
#define LANGUAGE_ENTRY(name) { #name, CONFIG_TYPE_STRING, (void *)&language_container[name] }
2016-09-08 18:37:03 +00:00
ConfigEntry language_entries[] = {
// General strings
LANGUAGE_ENTRY(ERROR),
LANGUAGE_ENTRY(OK),
LANGUAGE_ENTRY(YES),
LANGUAGE_ENTRY(NO),
LANGUAGE_ENTRY(CANCEL),
2016-10-31 18:35:25 +00:00
LANGUAGE_ENTRY(ON),
LANGUAGE_ENTRY(OFF),
2016-10-30 11:57:36 +00:00
LANGUAGE_ENTRY(FILE_),
2016-09-07 19:56:40 +00:00
LANGUAGE_ENTRY(FOLDER),
2016-09-08 18:37:03 +00:00
// Progress strings
LANGUAGE_ENTRY(MOVING),
LANGUAGE_ENTRY(COPYING),
LANGUAGE_ENTRY(DELETING),
2016-09-14 09:33:52 +00:00
LANGUAGE_ENTRY(EXPORTING),
2016-09-08 18:37:03 +00:00
LANGUAGE_ENTRY(INSTALLING),
LANGUAGE_ENTRY(DOWNLOADING),
LANGUAGE_ENTRY(EXTRACTING),
2016-10-15 13:03:26 +00:00
LANGUAGE_ENTRY(COMPRESSING),
2016-09-08 18:37:03 +00:00
LANGUAGE_ENTRY(HASHING),
2017-02-27 20:53:38 +00:00
LANGUAGE_ENTRY(REFRESHING),
2016-09-08 18:37:03 +00:00
// Audio player strings
LANGUAGE_ENTRY(TITLE),
LANGUAGE_ENTRY(ALBUM),
LANGUAGE_ENTRY(ARTIST),
LANGUAGE_ENTRY(GENRE),
LANGUAGE_ENTRY(YEAR),
2016-09-08 18:37:03 +00:00
// Hex editor strings
2016-10-30 11:57:36 +00:00
LANGUAGE_ENTRY(OFFSET),
2016-09-08 18:37:03 +00:00
LANGUAGE_ENTRY(OPEN_HEX_EDITOR),
// Text editor strings
2016-09-07 19:56:40 +00:00
LANGUAGE_ENTRY(EDIT_LINE),
2016-09-08 18:49:26 +00:00
LANGUAGE_ENTRY(ENTER_SEARCH_TERM),
2016-09-08 18:37:03 +00:00
2017-02-13 10:06:23 +00:00
// Context menu strings
2017-02-27 20:53:38 +00:00
LANGUAGE_ENTRY(REFRESH_LIVEAREA),
2017-02-13 10:06:23 +00:00
LANGUAGE_ENTRY(MOUNT_UMA0),
LANGUAGE_ENTRY(MOUNT_USB_UX0),
LANGUAGE_ENTRY(UMOUNT_USB_UX0),
LANGUAGE_ENTRY(SORT_BY),
LANGUAGE_ENTRY(BY_NAME),
LANGUAGE_ENTRY(BY_SIZE),
LANGUAGE_ENTRY(BY_DATE),
LANGUAGE_ENTRY(MARK_ALL),
LANGUAGE_ENTRY(UNMARK_ALL),
LANGUAGE_ENTRY(MOVE),
LANGUAGE_ENTRY(COPY),
LANGUAGE_ENTRY(PASTE),
LANGUAGE_ENTRY(DELETE),
LANGUAGE_ENTRY(RENAME),
LANGUAGE_ENTRY(NEW_FOLDER),
2016-10-30 11:57:36 +00:00
LANGUAGE_ENTRY(PROPERTIES),
2017-02-13 10:06:23 +00:00
LANGUAGE_ENTRY(MORE),
2016-10-15 13:03:26 +00:00
LANGUAGE_ENTRY(COMPRESS),
2016-09-07 19:56:40 +00:00
LANGUAGE_ENTRY(INSTALL_ALL),
LANGUAGE_ENTRY(INSTALL_FOLDER),
2016-09-07 19:56:40 +00:00
LANGUAGE_ENTRY(CALCULATE_SHA1),
2016-09-14 09:33:52 +00:00
LANGUAGE_ENTRY(EXPORT_MEDIA),
2017-02-13 10:06:23 +00:00
LANGUAGE_ENTRY(CUT),
LANGUAGE_ENTRY(INSERT_EMPTY_LINE),
2016-09-08 18:49:26 +00:00
LANGUAGE_ENTRY(SEARCH),
2016-09-08 18:37:03 +00:00
2016-10-30 11:57:36 +00:00
// File browser properties strings
LANGUAGE_ENTRY(PROPERTY_NAME),
LANGUAGE_ENTRY(PROPERTY_TYPE),
2016-10-30 13:06:50 +00:00
LANGUAGE_ENTRY(PROPERTY_FSELF_MODE),
2016-10-30 11:57:36 +00:00
LANGUAGE_ENTRY(PROPERTY_SIZE),
2016-10-30 13:06:50 +00:00
LANGUAGE_ENTRY(PROPERTY_COMPRESSED_SIZE),
2016-10-30 11:57:36 +00:00
LANGUAGE_ENTRY(PROPERTY_CONTAINS),
LANGUAGE_ENTRY(PROPERTY_CONTAINS_FILES_FOLDERS),
LANGUAGE_ENTRY(PROPERTY_CREATION_DATE),
LANGUAGE_ENTRY(PROPERTY_MODFICATION_DATE),
LANGUAGE_ENTRY(PROPERTY_TYPE_BMP),
LANGUAGE_ENTRY(PROPERTY_TYPE_INI),
LANGUAGE_ENTRY(PROPERTY_TYPE_JPEG),
LANGUAGE_ENTRY(PROPERTY_TYPE_MP3),
LANGUAGE_ENTRY(PROPERTY_TYPE_OGG),
LANGUAGE_ENTRY(PROPERTY_TYPE_PNG),
2017-01-13 16:41:04 +00:00
LANGUAGE_ENTRY(PROPERTY_TYPE_RAR),
2016-10-30 11:57:36 +00:00
LANGUAGE_ENTRY(PROPERTY_TYPE_SFO),
LANGUAGE_ENTRY(PROPERTY_TYPE_TXT),
LANGUAGE_ENTRY(PROPERTY_TYPE_VPK),
LANGUAGE_ENTRY(PROPERTY_TYPE_XML),
LANGUAGE_ENTRY(PROPERTY_TYPE_ZIP),
2016-10-30 13:06:50 +00:00
LANGUAGE_ENTRY(PROPERTY_TYPE_FSELF),
LANGUAGE_ENTRY(PROPERTY_FSELF_MODE_SAFE),
LANGUAGE_ENTRY(PROPERTY_FSELF_MODE_UNSAFE),
LANGUAGE_ENTRY(PROPERTY_FSELF_MODE_SCE),
2016-10-30 11:57:36 +00:00
2016-09-08 18:37:03 +00:00
// File browser strings
2017-02-28 18:35:01 +00:00
LANGUAGE_ENTRY(REFRESHED),
LANGUAGE_ENTRY(COPIED_FILE),
LANGUAGE_ENTRY(COPIED_FOLDER),
LANGUAGE_ENTRY(COPIED_FILES_FOLDERS),
2016-09-08 18:37:03 +00:00
// Dialog questions
LANGUAGE_ENTRY(DELETE_FILE_QUESTION),
LANGUAGE_ENTRY(DELETE_FOLDER_QUESTION),
LANGUAGE_ENTRY(DELETE_FILES_FOLDERS_QUESTION),
2016-09-14 09:33:52 +00:00
LANGUAGE_ENTRY(EXPORT_FILE_QUESTION),
LANGUAGE_ENTRY(EXPORT_FOLDER_QUESTION),
LANGUAGE_ENTRY(EXPORT_FILES_FOLDERS_QUESTION),
2016-09-14 09:45:46 +00:00
LANGUAGE_ENTRY(EXPORT_NO_MEDIA),
LANGUAGE_ENTRY(EXPORT_SONGS_INFO),
LANGUAGE_ENTRY(EXPORT_PICTURES_INFO),
LANGUAGE_ENTRY(EXPORT_SONGS_PICTURES_INFO),
2016-09-04 13:12:31 +00:00
LANGUAGE_ENTRY(INSTALL_ALL_QUESTION),
LANGUAGE_ENTRY(INSTALL_FOLDER_QUESTION),
LANGUAGE_ENTRY(INSTALL_QUESTION),
2016-08-27 17:16:39 +00:00
LANGUAGE_ENTRY(INSTALL_WARNING),
2016-10-27 18:17:20 +00:00
LANGUAGE_ENTRY(INSTALL_BRICK_WARNING),
2016-09-07 19:56:40 +00:00
LANGUAGE_ENTRY(HASH_FILE_QUESTION),
2017-02-27 20:53:38 +00:00
LANGUAGE_ENTRY(SAVE_MODIFICATIONS),
LANGUAGE_ENTRY(REFRESH_LIVEAREA_QUESTION),
2016-09-08 18:37:03 +00:00
2016-11-01 15:49:27 +00:00
// HENkaku settings strings
LANGUAGE_ENTRY(HENKAKU_SETTINGS),
2016-10-31 18:35:25 +00:00
LANGUAGE_ENTRY(HENKAKU_ENABLE_PSN_SPOOFING),
LANGUAGE_ENTRY(HENKAKU_ENABLE_UNSAFE_HOMEBREW),
LANGUAGE_ENTRY(HENKAKU_ENABLE_VERSION_SPOOFING),
LANGUAGE_ENTRY(HENKAKU_SPOOFED_VERSION),
2016-11-01 17:25:42 +00:00
LANGUAGE_ENTRY(HENKAKU_RESTORE_DEFAULT_SETTINGS),
2016-11-28 20:35:38 +00:00
LANGUAGE_ENTRY(HENKAKU_RELOAD_CONFIG),
LANGUAGE_ENTRY(HENKAKU_RESTORE_DEFAULT_MESSAGE),
LANGUAGE_ENTRY(HENKAKU_RELOAD_CONFIG_MESSAGE),
2016-11-01 09:35:00 +00:00
LANGUAGE_ENTRY(HENKAKU_UNSAFE_HOMEBREW_MESSAGE),
2016-10-31 18:35:25 +00:00
2016-10-31 19:31:44 +00:00
// VitaShell settings
LANGUAGE_ENTRY(VITASHELL_SETTINGS_MAIN),
LANGUAGE_ENTRY(VITASHELL_SETTINGS_LANGUAGE),
LANGUAGE_ENTRY(VITASHELL_SETTINGS_THEME),
2017-03-05 11:32:53 +00:00
LANGUAGE_ENTRY(VITASHELL_SETTINGS_USBDEVICE),
2017-01-12 16:45:52 +00:00
LANGUAGE_ENTRY(VITASHELL_SETTINGS_SELECT_BUTTON),
2016-11-02 18:54:40 +00:00
LANGUAGE_ENTRY(VITASHELL_SETTINGS_NO_AUTO_UPDATE),
2017-03-13 20:45:04 +00:00
LANGUAGE_ENTRY(VITASHELL_SETTINGS_RESTART_SHELL),
2016-11-01 17:25:42 +00:00
LANGUAGE_ENTRY(VITASHELL_SETTINGS_POWER),
LANGUAGE_ENTRY(VITASHELL_SETTINGS_REBOOT),
LANGUAGE_ENTRY(VITASHELL_SETTINGS_POWEROFF),
LANGUAGE_ENTRY(VITASHELL_SETTINGS_STANDBY),
2017-03-05 11:32:53 +00:00
LANGUAGE_ENTRY(VITASHELL_SETTINGS_USB_MEMORY_CARD),
LANGUAGE_ENTRY(VITASHELL_SETTINGS_USB_GAME_CARD),
2017-01-12 16:45:52 +00:00
LANGUAGE_ENTRY(VITASHELL_SETTINGS_SELECT_BUTTON_USB),
LANGUAGE_ENTRY(VITASHELL_SETTINGS_SELECT_BUTTON_FTP),
// USB strings
LANGUAGE_ENTRY(USB_CONNECTED),
2017-02-13 10:06:23 +00:00
LANGUAGE_ENTRY(USB_UMA0_MOUNTED),
LANGUAGE_ENTRY(USB_UX0_MOUNTED),
LANGUAGE_ENTRY(USB_UX0_UMOUNTED),
2017-03-05 11:32:53 +00:00
LANGUAGE_ENTRY(USB_NOT_CONNECTED),
LANGUAGE_ENTRY(USB_CONNECTION_NOT_AVAILABLE),
LANGUAGE_ENTRY(USB_WAIT_ATTACH),
2016-10-31 19:31:44 +00:00
2016-09-08 18:37:03 +00:00
// Others
2016-12-11 21:30:07 +00:00
LANGUAGE_ENTRY(SAFE_MODE),
LANGUAGE_ENTRY(UNSAFE_MODE),
2016-09-13 21:09:47 +00:00
LANGUAGE_ENTRY(PLEASE_WAIT),
2017-03-05 11:32:53 +00:00
LANGUAGE_ENTRY(GAME_CARD_NOT_FOUND),
2016-09-12 20:34:03 +00:00
LANGUAGE_ENTRY(NO_SPACE_ERROR),
2017-02-26 21:02:29 +00:00
LANGUAGE_ENTRY(EXTENDED_PERMISSIONS_REQUIRED),
LANGUAGE_ENTRY(WIFI_ERROR),
LANGUAGE_ENTRY(FTP_SERVER),
2016-09-04 09:19:11 +00:00
LANGUAGE_ENTRY(UPDATE_QUESTION),
2016-10-27 16:38:21 +00:00
LANGUAGE_ENTRY(ARCHIVE_NAME),
LANGUAGE_ENTRY(COMPRESSION_LEVEL),
};
2016-08-27 17:16:39 +00:00
// Load default config file
2017-02-26 21:02:29 +00:00
readConfigBuffer(&_binary_resources_english_us_txt_start, (int)&_binary_resources_english_us_txt_size, language_entries, sizeof(language_entries) / sizeof(ConfigEntry));
2016-08-06 06:59:41 +00:00
2016-08-27 17:16:39 +00:00
// Load custom config file
2016-08-27 10:49:03 +00:00
if (use_custom_config) {
2017-02-26 21:02:29 +00:00
if (id >= 0 && id < (sizeof(lang) / sizeof(char *))) {
2017-02-25 09:27:52 +00:00
char path[MAX_PATH_LENGTH];
snprintf(path, MAX_PATH_LENGTH, "ux0:VitaShell/language/%s.txt", lang[id]);
2017-02-26 21:02:29 +00:00
readConfig(path, language_entries, sizeof(language_entries) / sizeof(ConfigEntry));
2016-08-27 10:49:03 +00:00
}
2016-08-06 06:59:41 +00:00
}
2016-09-04 12:29:21 +00:00
}