Skip to content

Commit

Permalink
Merge pull request #354 from openstudiocoalition/Internationalization
Browse files Browse the repository at this point in the history
Internationalization: translate first tab of the app to English, French, Spanish, Chinese, Greek, Polish, Catalan, Farsi-Persian, Hindi, Japanese, Italian, German, Vietnamese
  • Loading branch information
jmarrec authored May 5, 2022
2 parents 10f5c92 + 596d2c7 commit 746accf
Show file tree
Hide file tree
Showing 36 changed files with 24,151 additions and 248 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/app_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,15 @@ jobs:
echo "$QT_INSTALL_DIR/bin" >> $GITHUB_PATH
echo QT_INSTALL_DIR=$QT_INSTALL_DIR >> $GITHUB_ENV
ls ./build/Qt-install/$QT_VERSION/
ls $QT_INSTALL_DIR || true
ls $QT_INSTALL_DIR/lib || true
ls $QT_INSTALL_DIR/lib/cmake || true
#ls ./build/Qt-install/$QT_VERSION/
#ls $QT_INSTALL_DIR || true
#ls $QT_INSTALL_DIR/lib || true
#ls $QT_INSTALL_DIR/lib/cmake || true
find ./build/Qt-install -name "*.cmake"
#ls $QT_INSTALL_DIR/translations || true
#ls $QT_INSTALL_DIR/translations/qtwebengine_locales || true
find ./build/Qt-install . -name "*.qm"
find ./build/Qt-install . -name "*.pak"
#- name: Cache Qt dep cache?
## To avoid downloading the Qt dependency all the time, we try to cache it
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ find_package(Qt6 ${QT_VERSION} COMPONENTS CoreTools GuiTools WidgetsTools QmlToo

find_package(Qt6 ${QT_VERSION} COMPONENTS Core Core5Compat Gui Widgets Sql Network Xml Concurrent PrintSupport Quick QuickWidgets Qml WebChannel Positioning WebEngineCore WebEngineWidgets REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)

find_package(Qt6LinguistTools ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)

if(APPLE)
set(QtWebEngineProcess "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app" CACHE PATH "Path to the QtWebEngineProcess")
else()
Expand Down Expand Up @@ -687,6 +689,8 @@ foreach(D ${project_directories})
endforeach()

add_subdirectory("ruby")
# Must be last in line, as it parses the sources files for the targets above
add_subdirectory("translations")

###############################################################################
# E X P O R T T A R G E T S #
Expand Down
2 changes: 1 addition & 1 deletion src/model_editor/InspectorDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void InspectorDialog::rebuildInspectorGadget(bool recursive) {
}

void InspectorDialog::saveState() {
QString organizationName("OpenStudio");
QString organizationName = QCoreApplication::organizationName();
QString applicationName("InspectorDialog");
QSettings settings(organizationName, applicationName);
settings.setValue("Geometry", QMainWindow::saveGeometry());
Expand Down
7 changes: 4 additions & 3 deletions src/model_editor/UserSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "Utilities.hpp"

#include <QCoreApplication>
#include <QString>
#include <QSettings>

Expand All @@ -49,7 +50,7 @@ std::vector<openstudio::BCLMeasure> userMeasures() {
}

openstudio::path userMeasuresDir() {
QSettings settings("OpenStudio", "BCLMeasure");
QSettings settings(QCoreApplication::organizationName(), "BCLMeasure");
QString value =
settings.value("userMeasuresDir", openstudio::toQString(openstudio::filesystem::home_path() / openstudio::toPath("OpenStudio/Measures")))
.toString();
Expand All @@ -70,12 +71,12 @@ bool setUserMeasuresDir(const openstudio::path& userMeasuresDir) {
return false;
}

QSettings settings("OpenStudio", "BCLMeasure");
QSettings settings(QCoreApplication::organizationName(), "BCLMeasure");
settings.setValue("userMeasuresDir", openstudio::toQString(userMeasuresDir));
return true;
}

void clearUserMeasuresDir() {
QSettings settings("OpenStudio", "BCLMeasure");
QSettings settings(QCoreApplication::organizationName(), "BCLMeasure");
settings.remove("userMeasuresDir");
}
21 changes: 14 additions & 7 deletions src/openstudio_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ elseif(UNIX)

endif()

#include_directories(SYSTEM ${RUBY_INCLUDE_DIRS})

add_executable(${target_name}
WIN32
MACOSX_BUNDLE
Expand Down Expand Up @@ -222,11 +220,6 @@ elseif( UNIX )
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_devtools} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_100} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_200} $<TARGET_FILE_DIR:${target_name}>/resources/
#COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/translations $<TARGET_FILE_DIR:${target_name}>/translations/
# Copying just one locale is enough to shut the annoying console warning...
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/translations/
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/translations/qtwebengine_locales
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_INSTALL_DIR}/translations/qtwebengine_locales/en-US.pak $<TARGET_FILE_DIR:${target_name}>/translations/qtwebengine_locales/
)

# Note: JM: Qt 6.3.0, I can no longer access $<TARGET_FILE:Qt6::QXcbIntegrationPlugin>
Expand Down Expand Up @@ -263,6 +256,16 @@ elseif( WIN32 )
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/qt.conf $<TARGET_FILE_DIR:${target_name}>
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${icudtl} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_devtools} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_100} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_200} $<TARGET_FILE_DIR:${target_name}>/resources/
)

add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:openstudio::openstudiolib> $<TARGET_FILE_DIR:${target_name}>/ )

endif()
Expand Down Expand Up @@ -382,6 +385,10 @@ if( APPLE )
#list(APPEND QTPLUGINS "\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/sceneparsers/libgltfsceneparser.dylib")
#list(APPEND QTPLUGINS "\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/sceneparsers/libassimpsceneparser.dylib")
install(DIRECTORY ${QtWebEngineProcess} DESTINATION "OpenStudioApp.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/A/Helpers/" COMPONENT OpenStudioApp USE_SOURCE_PERMISSIONS)

# TODO: this is definitely a shot in the dark and is unlikely to work. The WebEngine .paks in particular probably need to live somewhere else
install(DIRECTORY $<TARGET_FILE_DIR:openstudio_lib>/translations/ DESTINATION "OpenStudioApp.app/Contents/translations/" COMPONENT OpenStudioApp)

list(APPEND QTPLUGINS "\${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/A/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess")
endif()

Expand Down
Loading

0 comments on commit 746accf

Please sign in to comment.