mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-01 12:15:43 -06:00
use cpp file for function (#4187)
This commit is contained in:
parent
1018660ad7
commit
1012f84bf9
@ -1091,6 +1091,7 @@ set(IMGUI src/imgui/imgui_config.h
|
|||||||
src/imgui/imgui_layer.h
|
src/imgui/imgui_layer.h
|
||||||
src/imgui/imgui_std.h
|
src/imgui/imgui_std.h
|
||||||
src/imgui/imgui_texture.h
|
src/imgui/imgui_texture.h
|
||||||
|
src/imgui/imgui_translations.cpp
|
||||||
src/imgui/imgui_translations.h
|
src/imgui/imgui_translations.h
|
||||||
src/imgui/renderer/imgui_core.cpp
|
src/imgui/renderer/imgui_core.cpp
|
||||||
src/imgui/renderer/imgui_core.h
|
src/imgui/renderer/imgui_core.h
|
||||||
@ -1275,4 +1276,4 @@ install(TARGETS shadps4 BUNDLE DESTINATION .)
|
|||||||
else()
|
else()
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(tests)
|
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
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "core/emulator_settings.h"
|
namespace ImguiTranslate {
|
||||||
|
|
||||||
|
std::string tr(std::string input);
|
||||||
|
|
||||||
///////////// ImGui Translation Tables
|
///////////// ImGui Translation Tables
|
||||||
|
|
||||||
@ -130,55 +133,4 @@ const std::map<std::string, std::string> UkranianMap = {
|
|||||||
|
|
||||||
///////////// End ImGui Translation Tables
|
///////////// 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
|
} // namespace ImguiTranslate
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user