mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-20 04:12:35 +00:00
CMake: Unify translation directories
This commit is contained in:
parent
b397cb4b93
commit
f61388d7fc
@ -578,13 +578,9 @@ if(GETTEXT_MSGFMT_EXECUTABLE)
|
||||
|
||||
foreach(po ${LINGUAS})
|
||||
get_filename_component(lang ${po} NAME_WE)
|
||||
if(WIN32)
|
||||
set(mo_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages)
|
||||
set(mo ${mo_dir}/${lang}.mo)
|
||||
else()
|
||||
set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang})
|
||||
set(mo ${mo_dir}/dolphin-emu.mo)
|
||||
endif()
|
||||
|
||||
set(mo_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages/${lang})
|
||||
set(mo ${mo_dir}/dolphin-emu.mo)
|
||||
|
||||
target_sources(dolphin-emu PRIVATE ${mo})
|
||||
source_group("Localization\\\\Generated" FILES ${mo})
|
||||
@ -595,20 +591,11 @@ if(GETTEXT_MSGFMT_EXECUTABLE)
|
||||
install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
DEPENDS ${po}
|
||||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none ${po} ${pot_file}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
DEPENDS ${po}
|
||||
)
|
||||
endif()
|
||||
add_custom_command(OUTPUT ${mo}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||
DEPENDS ${po}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
@ -274,18 +274,17 @@ static bool TryInstallTranslator(const QString& exact_language_code)
|
||||
for (const auto& qlang : FindPossibleLanguageCodes(exact_language_code))
|
||||
{
|
||||
std::string lang = qlang.toStdString();
|
||||
auto filename =
|
||||
#if defined _WIN32
|
||||
fmt::format("{}/Languages/{}.mo", File::GetExeDirectory(), lang)
|
||||
#elif defined __APPLE__
|
||||
fmt::format("{}/Contents/Resources/{}.lproj/dolphin-emu.mo", File::GetBundleDirectory(),
|
||||
lang)
|
||||
#elif defined LINUX_LOCAL_DEV
|
||||
fmt::format("{}/../Source/Core/DolphinQt/{}/dolphin-emu.mo", File::GetExeDirectory(), lang)
|
||||
std::string filename;
|
||||
#if defined __APPLE__
|
||||
filename = fmt::format("{}/Contents/Resources/{}.lproj/dolphin-emu.mo",
|
||||
File::GetBundleDirectory(), lang);
|
||||
#else
|
||||
fmt::format("{}/../locale/{}/LC_MESSAGES/dolphin-emu.mo", DATA_DIR, lang)
|
||||
filename = fmt::format("{}/Languages/{}/dolphin-emu.mo", File::GetExeDirectory(), lang);
|
||||
#ifndef _WIN32
|
||||
if (!File::Exists(filename))
|
||||
filename = fmt::format("{}/../locale/{}/LC_MESSAGES/dolphin-emu.mo", DATA_DIR, lang);
|
||||
#endif
|
||||
#endif
|
||||
;
|
||||
|
||||
auto* translator = new MoTranslator(QApplication::instance());
|
||||
if (translator->load(filename))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user