mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:40:04 +00:00 
			
		
		
		
	Updating translation, disabling locations and line numbers in .ts files
This commit is contained in:
		
							parent
							
								
									ca3586420e
								
							
						
					
					
						commit
						0ab89060e9
					
				
					 4 changed files with 21 additions and 141 deletions
				
			
		|  | @ -1,102 +0,0 @@ | |||
| #============================================================================= | ||||
| # Copyright (C) 2020 The Qt Company Ltd. | ||||
| # Copyright 2005-2011 Kitware, Inc. | ||||
| # All rights reserved. | ||||
| # | ||||
| # Redistribution and use in source and binary forms, with or without | ||||
| # modification, are permitted provided that the following conditions | ||||
| # are met: | ||||
| # | ||||
| # * Redistributions of source code must retain the above copyright | ||||
| #   notice, this list of conditions and the following disclaimer. | ||||
| # | ||||
| # * Redistributions in binary form must reproduce the above copyright | ||||
| #   notice, this list of conditions and the following disclaimer in the | ||||
| #   documentation and/or other materials provided with the distribution. | ||||
| # | ||||
| # * Neither the name of Kitware, Inc. nor the names of its | ||||
| #   contributors may be used to endorse or promote products derived | ||||
| #   from this software without specific prior written permission. | ||||
| # | ||||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||||
| # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||||
| # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||||
| # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||||
| # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||||
| # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||||
| # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||||
| # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||||
| # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||||
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| #============================================================================= | ||||
| 
 | ||||
| # Modified to remove include directories from translation | ||||
| 
 | ||||
| function(qt6_create_translation_scwx _qm_files) | ||||
|     set(options) | ||||
|     set(oneValueArgs) | ||||
|     set(multiValueArgs OPTIONS) | ||||
| 
 | ||||
|     cmake_parse_arguments(_LUPDATE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||||
|     set(_lupdate_files ${_LUPDATE_UNPARSED_ARGUMENTS}) | ||||
|     set(_lupdate_options ${_LUPDATE_OPTIONS}) | ||||
| 
 | ||||
|     list(FIND _lupdate_options "-extensions" _extensions_index) | ||||
|     if(_extensions_index GREATER -1) | ||||
|         math(EXPR _extensions_index "${_extensions_index} + 1") | ||||
|         list(GET _lupdate_options ${_extensions_index} _extensions_list) | ||||
|         string(REPLACE "," ";" _extensions_list "${_extensions_list}") | ||||
|         list(TRANSFORM _extensions_list STRIP) | ||||
|         list(TRANSFORM _extensions_list REPLACE "^\." "") | ||||
|         list(TRANSFORM _extensions_list PREPEND "*.") | ||||
|     else() | ||||
|         set(_extensions_list "*.java;*.jui;*.ui;*.c;*.c++;*.cc;*.cpp;*.cxx;*.ch;*.h;*.h++;*.hh;*.hpp;*.hxx;*.js;*.qs;*.qml;*.qrc") | ||||
|     endif() | ||||
|     set(_my_sources) | ||||
|     set(_my_tsfiles) | ||||
|     foreach(_file ${_lupdate_files}) | ||||
|         get_filename_component(_ext ${_file} EXT) | ||||
|         get_filename_component(_abs_FILE ${_file} ABSOLUTE) | ||||
|         if(_ext MATCHES "ts") | ||||
|             list(APPEND _my_tsfiles ${_abs_FILE}) | ||||
|         else() | ||||
|             list(APPEND _my_sources ${_abs_FILE}) | ||||
|         endif() | ||||
|     endforeach() | ||||
|     foreach(_ts_file ${_my_tsfiles}) | ||||
|         if(_my_sources) | ||||
|           # make a list file to call lupdate on, so we don't make our commands too | ||||
|           # long for some systems | ||||
|           get_filename_component(_ts_name ${_ts_file} NAME) | ||||
|           set(_ts_lst_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lst_file") | ||||
|           set(_lst_file_srcs) | ||||
|           set(_dependencies) | ||||
|           foreach(_lst_file_src ${_my_sources}) | ||||
|               set(_lst_file_srcs "${_lst_file_src}\n${_lst_file_srcs}") | ||||
|               if(IS_DIRECTORY ${_lst_file_src}) | ||||
|                   list(TRANSFORM _extensions_list PREPEND "${_lst_file_src}/" OUTPUT_VARIABLE _directory_glob) | ||||
|                   file(GLOB_RECURSE _directory_contents CONFIGURE_DEPENDS ${_directory_glob}) | ||||
|                   list(APPEND _dependencies ${_directory_contents}) | ||||
|               else() | ||||
|                   list(APPEND _dependencies "${_lst_file_src}") | ||||
|               endif() | ||||
|           endforeach() | ||||
| 
 | ||||
|           # get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES) | ||||
|           # foreach(_pro_include ${_inc_DIRS}) | ||||
|           #     get_filename_component(_abs_include "${_pro_include}" ABSOLUTE) | ||||
|           #     set(_lst_file_srcs "-I${_pro_include}\n${_lst_file_srcs}") | ||||
|           # endforeach() | ||||
| 
 | ||||
|           file(WRITE ${_ts_lst_file} "${_lst_file_srcs}") | ||||
|         endif() | ||||
|         add_custom_command(OUTPUT ${_ts_file} | ||||
|             COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::lupdate | ||||
|             ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file} | ||||
|             DEPENDS ${_dependencies} | ||||
|             VERBATIM) | ||||
|     endforeach() | ||||
|     qt6_add_translation(${_qm_files} ${_my_tsfiles}) | ||||
|     set(${_qm_files} ${${_qm_files}} PARENT_SCOPE) | ||||
| endfunction() | ||||
|  | @ -16,19 +16,6 @@ find_package(Freetype) | |||
| find_package(geographiclib) | ||||
| find_package(glm) | ||||
| 
 | ||||
| # QtCreator supports the following variables for Android, which are identical to qmake Android variables. | ||||
| # Check https://doc.qt.io/qt/deployment-android.html for more information. | ||||
| # They need to be set before the find_package( ...) calls below. | ||||
| 
 | ||||
| #if(ANDROID) | ||||
| #    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") | ||||
| #    if (ANDROID_ABI STREQUAL "armeabi-v7a") | ||||
| #        set(ANDROID_EXTRA_LIBS | ||||
| #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so | ||||
| #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) | ||||
| #    endif() | ||||
| #endif() | ||||
| 
 | ||||
| find_package(QT NAMES Qt6 | ||||
|              COMPONENTS Gui | ||||
|                         LinguistTools | ||||
|  | @ -46,8 +33,6 @@ find_package(Qt${QT_VERSION_MAJOR} | |||
|                         Widgets | ||||
|              REQUIRED) | ||||
| 
 | ||||
| include(qt6-linguist.cmake) | ||||
| 
 | ||||
| set(SRC_EXE_MAIN source/scwx/qt/main/main.cpp) | ||||
| 
 | ||||
| set(HDR_MAIN source/scwx/qt/main/main_window.hpp) | ||||
|  | @ -205,9 +190,17 @@ source_group("I18N Files"             FILES ${TS_FILES}) | |||
| add_library(scwx-qt OBJECT ${PROJECT_SOURCES}) | ||||
| set_property(TARGET scwx-qt PROPERTY AUTOMOC ON) | ||||
| 
 | ||||
| qt_add_executable(supercell-wx ${EXECUTABLE_SOURCES}) | ||||
| qt_add_translations(scwx-qt TS_FILES ${TS_FILES} | ||||
|                     INCLUDE_DIRECTORIES true | ||||
|                     LUPDATE_OPTIONS -locations none -no-ui-lines) | ||||
| 
 | ||||
| qt6_create_translation_scwx(QM_FILES ${scwx-qt_SOURCE_DIR} ${TS_FILES}) | ||||
| set_target_properties(release_translations PROPERTIES FOLDER qt) | ||||
| set_target_properties(scwx-qt_lrelease     PROPERTIES FOLDER qt) | ||||
| set_target_properties(scwx-qt_lupdate      PROPERTIES FOLDER qt) | ||||
| set_target_properties(scwx-qt_other_files  PROPERTIES FOLDER qt) | ||||
| set_target_properties(update_translations  PROPERTIES FOLDER qt) | ||||
| 
 | ||||
| qt_add_executable(supercell-wx ${EXECUTABLE_SOURCES}) | ||||
| 
 | ||||
| if (WIN32) | ||||
|     target_compile_definitions(scwx-qt      PUBLIC WIN32_LEAN_AND_MEAN) | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ | |||
| #include <boost/asio.hpp> | ||||
| #include <spdlog/spdlog.h> | ||||
| #include <QApplication> | ||||
| #include <QTranslator> | ||||
| 
 | ||||
| static const std::string logPrefix_ = "scwx::main"; | ||||
| static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||
|  | @ -20,8 +21,17 @@ int main(int argc, char* argv[]) | |||
|    scwx::util::Logger::Initialize(); | ||||
|    spdlog::set_level(spdlog::level::debug); | ||||
| 
 | ||||
|    QApplication a(argc, argv); | ||||
| 
 | ||||
|    QCoreApplication::setApplicationName("Supercell Wx"); | ||||
| 
 | ||||
|    // Enable internationalization support
 | ||||
|    QTranslator translator; | ||||
|    if (translator.load(QLocale(), "scwx", "_", ":/i18n")) | ||||
|    { | ||||
|       QCoreApplication::installTranslator(&translator); | ||||
|    } | ||||
| 
 | ||||
|    // Start the io_context main loop
 | ||||
|    boost::asio::io_context& ioContext = scwx::util::io_context(); | ||||
|    auto                     work      = boost::asio::make_work_guard(ioContext); | ||||
|  | @ -56,7 +66,6 @@ int main(int argc, char* argv[]) | |||
|    // Run Qt main loop
 | ||||
|    int result; | ||||
|    { | ||||
|       QApplication               a(argc, argv); | ||||
|       scwx::qt::main::MainWindow w; | ||||
|       w.show(); | ||||
|       result = a.exec(); | ||||
|  |  | |||
|  | @ -1,85 +1,69 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!DOCTYPE TS> | ||||
| <TS version="2.1" language="scwx-qt_en_US"> | ||||
| <TS version="2.1" language="en_US" sourcelanguage="en_US"> | ||||
| <context> | ||||
|     <name>MainWindow</name> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="61"/> | ||||
|         <source>Toolbox</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="98"/> | ||||
|         <source>...</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="176"/> | ||||
|         <source>Level 3</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="129"/> | ||||
|         <source>Radar Site</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="14"/> | ||||
|         <source>Supercell Wx</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="43"/> | ||||
|         <source>&File</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="51"/> | ||||
|         <source>&Help</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="112"/> | ||||
|         <source>Volume Coverage Pattern</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="115"/> | ||||
|         <source>VCP</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="136"/> | ||||
|         <source>Clear Air Mode</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="153"/> | ||||
|         <source>Radar Products</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="159"/> | ||||
|         <source>Level 2</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="222"/> | ||||
|         <source>E&xit</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="227"/> | ||||
|         <source>About &Supercell Wx...</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="232"/> | ||||
|         <source>&Open...</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="235"/> | ||||
|         <source>Ctrl+O</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|  | @ -87,7 +71,6 @@ | |||
| <context> | ||||
|     <name>scwx::qt::main::MainWindow</name> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.cpp" line="262"/> | ||||
|         <source>Unrecognized NEXRAD Product:</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|  | @ -95,17 +78,14 @@ | |||
| <context> | ||||
|     <name>scwx::qt::ui::Level2SettingsWidgetImpl</name> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/ui/level2_settings_widget.cpp" line="37"/> | ||||
|         <source>Elevation</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/ui/level2_settings_widget.cpp" line="41"/> | ||||
|         <source>Settings</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/ui/level2_settings_widget.cpp" line="45"/> | ||||
|         <source>Declutter</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat