Skip to content

Commit

Permalink
fix(i18n): Windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mfep committed Jun 18, 2024
1 parent bdf75c2 commit 77eaab5
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 53 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
-D MC_CHECK_FOR_UPDATES=ON
-D CMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
-D CMAKE_CXX_FLAGS="/await /EHsc"
-D X_VCPKG_APPLOCAL_DEPS_INSTALL=ON
-T host=x64
-A x64
- name: Build
Expand Down
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ if(NOT WIN32 AND MC_CHECK_FOR_UPDATES)
endif()
find_package(Intl REQUIRED)
if (NOT TARGET Intl::Intl)
add_library(Intl UNKNOWN IMPORTED)
target_include_directories(Intl PUBLIC "${Intl_INCLUDE_DIRS}")
target_link_libraries(Intl PUBLIC "${Intl_LIBRARIES}")
add_library(Intl::Intl ALIAS Intl)
add_library(Intl::Intl UNKNOWN IMPORTED)
target_include_directories(Intl::Intl PUBLIC "${Intl_INCLUDE_DIRS}")
target_link_libraries(Intl::Intl PUBLIC "${Intl_LIBRARIES}")
endif()

set(MC_LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALEDIR}")
Expand Down Expand Up @@ -135,8 +134,6 @@ if(WIN32)
set(CPACK_WIX_UPGRADE_GUID "96D23EBE-7D9E-4C53-8CD7-6E5CC32A5CE1")
set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/data/packaging/wix_patch.xml")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
install(IMPORTED_RUNTIME_ARTIFACTS spdlog::spdlog fmt::fmt SDL2::SDL2 freetype
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
target_compile_definitions(midiconn PRIVATE
WINVER=0x0A00
NTDDI_VERSION=0x0A000000
Expand Down
44 changes: 22 additions & 22 deletions po/hu.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: midiconn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-17 12:08+0200\n"
"POT-Creation-Date: 2024-06-18 17:27+0200\n"
"PO-Revision-Date: 2024-06-17 12:09+0200\n"
"Last-Translator: <>\n"
"Language-Team: Hungarian\n"
Expand Down Expand Up @@ -84,116 +84,116 @@ msgid "Interface Scale"
msgstr "Megjelenítés nagyítása"

#. Translators: Menu entry for selecting the display language
#: src/Application.cpp:269
#: src/Application.cpp:271
msgid "Language"
msgstr "Nyelv"

#: src/Application.cpp:273
#: src/Application.cpp:275
msgid "Reset to system language"
msgstr "Visszaállítás a rendszer nyelvére"

#. Translators: Menu entry that controls whether the full or abbreviated MIDI port names
#. are displayed
#: src/Application.cpp:291
#: src/Application.cpp:294
msgid "Show full port names"
msgstr "Teljes eszköznevek kijelzése"

#. Translators: Menu entry for the help submenu
#: src/Application.cpp:300
#: src/Application.cpp:303
msgid "Help"
msgstr "Súgó"

#. Translators: Menu entry to enable and disable debug logging
#: src/Application.cpp:305
#: src/Application.cpp:308
msgid "Enable debug log"
msgstr "Hibalog engedélyezése"

#. Translators: Menu entry to open the log file with the default application
#: src/Application.cpp:313
#: src/Application.cpp:316
msgid "Open logfile"
msgstr "Logfájl megnyitása"

#. Translators: Menu entry to open the project's website with the browser
#: src/Application.cpp:320 src/Application.cpp:395
#: src/Application.cpp:323 src/Application.cpp:398
msgid "Visit website"
msgstr "Weboldal felkeresése"

#. Translators: Menu entry to open the about window
#: src/Application.cpp:327
#: src/Application.cpp:330
msgid "About"
msgstr "Névjegy"

#. Translators: Welcome message in the welcome window
#: src/Application.cpp:355
#: src/Application.cpp:358
#, c-format
msgid "Welcome to %s"
msgstr "Üdvözli a %s"

#. Translators: Message in the welcome window while downloading the
#. latest version number
#: src/Application.cpp:367
#: src/Application.cpp:370
#, c-format
msgid "Fetching latest %s version number..."
msgstr "Legutóbbi %s verziószám lekérése..."

#. Translators: Message in the welcome window, when an error occurred
#. while fetching the version number from the web
#: src/Application.cpp:373
#: src/Application.cpp:376
#, c-format
msgid "Error fetching latest %s version number"
msgstr "Hiba a legutóbbi %s verziószám lekérésénél"

#. Translators: Message in the welcome window, when the downloaded
#. latest version is the same as the current application's version
#: src/Application.cpp:383
#: src/Application.cpp:386
#, c-format
msgid "Congratulations! You are using the latest version of %s"
msgstr "Gratulálunk! A %s legújabb verzióját használja"

#. Translators: Message in the welcome window, when the downloaded
#. latest version is newer than the current application's version
#: src/Application.cpp:391
#: src/Application.cpp:394
#, c-format
msgid "A new version of %s is available: %s"
msgstr "Egy új %s verzió elérhető: %s"

#. Translators: Checkbox on the welcome window
#: src/Application.cpp:406
#: src/Application.cpp:409
msgid "Show this window on application startup"
msgstr "Ablak megjelenítése indításkor"

#. Translators: Button on the welcome window to create a new empty preset
#: src/Application.cpp:411
#: src/Application.cpp:414
msgid "New preset - empty"
msgstr "Új konfiguráció - üres"

#. Translators: Button on the welcome window to create a new preset filled with all
#. available devices
#: src/Application.cpp:419
#: src/Application.cpp:422
msgid "New preset - add all MIDI devices"
msgstr "Új konfiguráció - az összes MIDI eszközzel"

#. Translators: Button on the welcome window to browse the filesystem for a preset to load
#: src/Application.cpp:426
#: src/Application.cpp:429
msgid "Browse preset"
msgstr "Konfiguráció tallózása"

#. Translators: Button on the welcome window to open the last opened preset
#: src/Application.cpp:435
#: src/Application.cpp:438
msgid "Open last preset"
msgstr "Legutóbbi konfiguráció megnyitása"

#. Translators: Button on the welcome window to show the 3rd party library licenses
#: src/Application.cpp:447
#: src/Application.cpp:450
msgid "Open source licenses"
msgstr "Licencinformációk"

#. Translators: The message on the popup window when attempting to close the program
#: src/Application.cpp:468
#: src/Application.cpp:471
msgid "Do you want to save changes?"
msgstr "Menti a módosításokat?"

#: src/Locale.cpp:26
#: src/Locale.cpp:24
msgid "The change of display language is applied after restart"
msgstr "A nyelv megváltoztatása a program újraindítása után jut érvényre"

Expand Down
44 changes: 22 additions & 22 deletions po/midiconn.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-17 12:08+0200\n"
"POT-Creation-Date: 2024-06-18 17:27+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -85,116 +85,116 @@ msgid "Interface Scale"
msgstr ""

#. Translators: Menu entry for selecting the display language
#: src/Application.cpp:269
#: src/Application.cpp:271
msgid "Language"
msgstr ""

#: src/Application.cpp:273
#: src/Application.cpp:275
msgid "Reset to system language"
msgstr ""

#. Translators: Menu entry that controls whether the full or abbreviated MIDI port names
#. are displayed
#: src/Application.cpp:291
#: src/Application.cpp:294
msgid "Show full port names"
msgstr ""

#. Translators: Menu entry for the help submenu
#: src/Application.cpp:300
#: src/Application.cpp:303
msgid "Help"
msgstr ""

#. Translators: Menu entry to enable and disable debug logging
#: src/Application.cpp:305
#: src/Application.cpp:308
msgid "Enable debug log"
msgstr ""

#. Translators: Menu entry to open the log file with the default application
#: src/Application.cpp:313
#: src/Application.cpp:316
msgid "Open logfile"
msgstr ""

#. Translators: Menu entry to open the project's website with the browser
#: src/Application.cpp:320 src/Application.cpp:395
#: src/Application.cpp:323 src/Application.cpp:398
msgid "Visit website"
msgstr ""

#. Translators: Menu entry to open the about window
#: src/Application.cpp:327
#: src/Application.cpp:330
msgid "About"
msgstr ""

#. Translators: Welcome message in the welcome window
#: src/Application.cpp:355
#: src/Application.cpp:358
#, c-format
msgid "Welcome to %s"
msgstr ""

#. Translators: Message in the welcome window while downloading the
#. latest version number
#: src/Application.cpp:367
#: src/Application.cpp:370
#, c-format
msgid "Fetching latest %s version number..."
msgstr ""

#. Translators: Message in the welcome window, when an error occurred
#. while fetching the version number from the web
#: src/Application.cpp:373
#: src/Application.cpp:376
#, c-format
msgid "Error fetching latest %s version number"
msgstr ""

#. Translators: Message in the welcome window, when the downloaded
#. latest version is the same as the current application's version
#: src/Application.cpp:383
#: src/Application.cpp:386
#, c-format
msgid "Congratulations! You are using the latest version of %s"
msgstr ""

#. Translators: Message in the welcome window, when the downloaded
#. latest version is newer than the current application's version
#: src/Application.cpp:391
#: src/Application.cpp:394
#, c-format
msgid "A new version of %s is available: %s"
msgstr ""

#. Translators: Checkbox on the welcome window
#: src/Application.cpp:406
#: src/Application.cpp:409
msgid "Show this window on application startup"
msgstr ""

#. Translators: Button on the welcome window to create a new empty preset
#: src/Application.cpp:411
#: src/Application.cpp:414
msgid "New preset - empty"
msgstr ""

#. Translators: Button on the welcome window to create a new preset filled with all
#. available devices
#: src/Application.cpp:419
#: src/Application.cpp:422
msgid "New preset - add all MIDI devices"
msgstr ""

#. Translators: Button on the welcome window to browse the filesystem for a preset to load
#: src/Application.cpp:426
#: src/Application.cpp:429
msgid "Browse preset"
msgstr ""

#. Translators: Button on the welcome window to open the last opened preset
#: src/Application.cpp:435
#: src/Application.cpp:438
msgid "Open last preset"
msgstr ""

#. Translators: Button on the welcome window to show the 3rd party library licenses
#: src/Application.cpp:447
#: src/Application.cpp:450
msgid "Open source licenses"
msgstr ""

#. Translators: The message on the popup window when attempting to close the program
#: src/Application.cpp:468
#: src/Application.cpp:471
msgid "Do you want to save changes?"
msgstr ""

#: src/Locale.cpp:26
#: src/Locale.cpp:24
msgid "The change of display language is applied after restart"
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ void Application::render_main_menu()
}
ImGui::EndMenu();
}
// This kind of locale selection is broken on Windows
#ifndef _WIN32
static auto language_label =
// Translators: Menu entry for selecting the display language
fmt::format("{} {}", ICON_FK_LANGUAGE, gettext("Language"));
Expand All @@ -285,6 +287,7 @@ void Application::render_main_menu()
}
ImGui::EndMenu();
}
#endif
bool show_full_port_names = m_port_name_display.get_show_full_port_names();
// Translators: Menu entry that controls whether the full or abbreviated MIDI port names
// are displayed
Expand Down
2 changes: 0 additions & 2 deletions src/Locale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include "portable-file-dialogs.h"
#include "spdlog/spdlog.h"

#include <clocale>

mc::Locale::Locale(ConfigFile& config_file) : m_config_file(&config_file)
{
const auto config_locale = m_config_file->get_locale();
Expand Down
8 changes: 7 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ MC_MAIN
spdlog::error("Cannot bind text domain");
return -1;
}
#ifdef _WIN32
if (bind_textdomain_codeset(MIDI_APPLICATION_NAME_SNAKE, "utf-8") == nullptr)
{
spdlog::error("Cannot bind text domain codeset");
return -1;
}
#endif
if (textdomain(MIDI_APPLICATION_NAME_SNAKE) == nullptr)
{
spdlog::error("Cannot set text domain");
return -1;
}

mc::platform::set_process_dpi_aware();

const auto file_to_open = mc::wrap_exception([&]() {
Expand Down

0 comments on commit 77eaab5

Please sign in to comment.