mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-01 18:40:57 -06:00
use cpp file for function
This commit is contained in:
parent
1018660ad7
commit
f19731683b
@ -1091,6 +1091,7 @@ set(IMGUI src/imgui/imgui_config.h
|
||||
src/imgui/imgui_layer.h
|
||||
src/imgui/imgui_std.h
|
||||
src/imgui/imgui_texture.h
|
||||
src/imgui/imgui_translations.cpp
|
||||
src/imgui/imgui_translations.h
|
||||
src/imgui/renderer/imgui_core.cpp
|
||||
src/imgui/renderer/imgui_core.h
|
||||
@ -1275,4 +1276,4 @@ install(TARGETS shadps4 BUNDLE DESTINATION .)
|
||||
else()
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
58
src/imgui/imgui_translations.cpp
Normal file
58
src/imgui/imgui_translations.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/emulator_settings.h"
|
||||
#include "imgui_translations.h"
|
||||
|
||||
namespace ImguiTranslate {
|
||||
|
||||
const std::map<u32, std::map<std::string, std::string>> langMap = {
|
||||
{0, JapaneseMap},
|
||||
// {1, EnglishUsMap}, - not used
|
||||
{2, FrenchMap},
|
||||
{3, SpanishMap},
|
||||
{4, GermanMap},
|
||||
{5, ItalianMap},
|
||||
{6, DutchMap},
|
||||
{7, PortugesePtMap},
|
||||
{8, RussianMap},
|
||||
{9, KoreanMap},
|
||||
{10, ChineseTraditionalMap},
|
||||
{11, ChineseSimplifiedMap},
|
||||
{12, FinnishMap},
|
||||
{13, SwedishMap},
|
||||
{14, DanishMap},
|
||||
{15, NorwegianMap},
|
||||
{16, PolishMap},
|
||||
{17, PortugeseBrMap},
|
||||
// {18, "English (UK)"}, - not used
|
||||
{19, TurkishMap},
|
||||
{20, SpanishLatinAmericanMap},
|
||||
{21, ArabicMap},
|
||||
{22, FrenchCanadaMap},
|
||||
{23, CzechMap},
|
||||
{24, HungarianMap},
|
||||
{25, GreekMap},
|
||||
{26, RomanianMap},
|
||||
{27, ThaiMap},
|
||||
{28, VietnameseMap},
|
||||
{29, IndonesianMap},
|
||||
{30, UkranianMap},
|
||||
};
|
||||
|
||||
std::string tr(std::string input) {
|
||||
// since we're coding in English
|
||||
if (EmulatorSettings.GetConsoleLanguage() == 1 || EmulatorSettings.GetConsoleLanguage() == 18)
|
||||
return input;
|
||||
|
||||
const std::map<std::string, std::string> translationTable =
|
||||
langMap.at(EmulatorSettings.GetConsoleLanguage());
|
||||
|
||||
if (!translationTable.contains(input)) {
|
||||
return input;
|
||||
}
|
||||
|
||||
return translationTable.at(input);
|
||||
}
|
||||
|
||||
} // namespace ImguiTranslate
|
||||
@ -2,8 +2,11 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "core/emulator_settings.h"
|
||||
namespace ImguiTranslate {
|
||||
|
||||
std::string tr(std::string input);
|
||||
|
||||
///////////// ImGui Translation Tables
|
||||
|
||||
@ -130,55 +133,4 @@ const std::map<std::string, std::string> UkranianMap = {
|
||||
|
||||
///////////// End ImGui Translation Tables
|
||||
|
||||
const std::map<u32, std::map<std::string, std::string>> langMap = {
|
||||
{0, JapaneseMap},
|
||||
// {1, EnglishUsMap}, - not used
|
||||
{2, FrenchMap},
|
||||
{3, SpanishMap},
|
||||
{4, GermanMap},
|
||||
{5, ItalianMap},
|
||||
{6, DutchMap},
|
||||
{7, PortugesePtMap},
|
||||
{8, RussianMap},
|
||||
{9, KoreanMap},
|
||||
{10, ChineseTraditionalMap},
|
||||
{11, ChineseSimplifiedMap},
|
||||
{12, FinnishMap},
|
||||
{13, SwedishMap},
|
||||
{14, DanishMap},
|
||||
{15, NorwegianMap},
|
||||
{16, PolishMap},
|
||||
{17, PortugeseBrMap},
|
||||
// {18, "English (UK)"}, - not used
|
||||
{19, TurkishMap},
|
||||
{20, SpanishLatinAmericanMap},
|
||||
{21, ArabicMap},
|
||||
{22, FrenchCanadaMap},
|
||||
{23, CzechMap},
|
||||
{24, HungarianMap},
|
||||
{25, GreekMap},
|
||||
{26, RomanianMap},
|
||||
{27, ThaiMap},
|
||||
{28, VietnameseMap},
|
||||
{29, IndonesianMap},
|
||||
{30, UkranianMap},
|
||||
};
|
||||
|
||||
namespace ImguiTranslate {
|
||||
|
||||
std::string tr(std::string input) {
|
||||
// since we're coding in English
|
||||
if (EmulatorSettings.GetConsoleLanguage() == 1 || EmulatorSettings.GetConsoleLanguage() == 18)
|
||||
return input;
|
||||
|
||||
const std::map<std::string, std::string> translationTable =
|
||||
langMap.at(EmulatorSettings.GetConsoleLanguage());
|
||||
|
||||
if (!translationTable.contains(input)) {
|
||||
return input;
|
||||
}
|
||||
|
||||
return translationTable.at(input);
|
||||
}
|
||||
|
||||
} // namespace ImguiTranslate
|
||||
|
||||
Loading…
Reference in New Issue
Block a user