CMake: Unify translation directories
This commit is contained in:
2 files changed
+17
-31
No files matched your search
@@ -582,13 +582,9 @@ if(GETTEXT_MSGFMT_EXECUTABLE)
|
|||||||
|
|
||||||
foreach(po ${LINGUAS})
|
foreach(po ${LINGUAS})
|
||||||
get_filename_component(lang ${po} NAME_WE)
|
get_filename_component(lang ${po} NAME_WE)
|
||||||
if(WIN32)
|
|
||||||
set(mo_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages)
|
set(mo_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages/${lang})
|
||||||
set(mo ${mo_dir}/${lang}.mo)
|
set(mo ${mo_dir}/dolphin-emu.mo)
|
||||||
else()
|
|
||||||
set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang})
|
|
||||||
set(mo ${mo_dir}/dolphin-emu.mo)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_sources(dolphin-emu PRIVATE ${mo})
|
target_sources(dolphin-emu PRIVATE ${mo})
|
||||||
source_group("Localization\\\\Generated" FILES ${mo})
|
source_group("Localization\\\\Generated" FILES ${mo})
|
||||||
@@ -599,20 +595,11 @@ if(GETTEXT_MSGFMT_EXECUTABLE)
|
|||||||
install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES)
|
install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
add_custom_command(OUTPUT ${mo}
|
||||||
add_custom_command(OUTPUT ${mo}
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
|
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
||||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
|
DEPENDS ${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()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -274,18 +274,17 @@ static bool TryInstallTranslator(const QString& exact_language_code)
|
|||||||
for (const auto& qlang : FindPossibleLanguageCodes(exact_language_code))
|
for (const auto& qlang : FindPossibleLanguageCodes(exact_language_code))
|
||||||
{
|
{
|
||||||
std::string lang = qlang.toStdString();
|
std::string lang = qlang.toStdString();
|
||||||
auto filename =
|
std::string filename;
|
||||||
#if defined _WIN32
|
#if defined __APPLE__
|
||||||
fmt::format("{}/Languages/{}.mo", File::GetExeDirectory(), lang)
|
filename = fmt::format("{}/Contents/Resources/{}.lproj/dolphin-emu.mo",
|
||||||
#elif defined __APPLE__
|
File::GetBundleDirectory(), lang);
|
||||||
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)
|
|
||||||
#else
|
#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
|
#endif
|
||||||
;
|
|
||||||
|
|
||||||
auto* translator = new MoTranslator(QApplication::instance());
|
auto* translator = new MoTranslator(QApplication::instance());
|
||||||
if (translator->load(filename))
|
if (translator->load(filename))
|
||||||
|
|||||||
Reference in new issue
Block a user