feat: basic i18n support

This commit is contained in:
Gary Wang 2020-06-04 23:54:34 +08:00
parent f51232ed89
commit dbd576161a
3 changed files with 124 additions and 16 deletions

View File

@ -13,31 +13,51 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Widgets Multimedia Network REQUIRED)
find_package(Qt5 COMPONENTS Widgets Multimedia Network LinguistTools REQUIRED)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(TagLib REQUIRED taglib)
endif ()
set (PMUSIC_CPP_FILES
main.cpp
mainwindow.cpp
seekableslider.cpp
playlistmodel.cpp
singleapplicationmanager.cpp
)
set (PMUSIC_HEADER_FILES
mainwindow.h
seekableslider.h
playlistmodel.h
singleapplicationmanager.h
)
set (PMUSIC_UI_FILES
mainwindow.ui
)
set (EXE_NAME pmusic)
add_executable(${EXE_NAME}
main.cpp
mainwindow.cpp
mainwindow.h
seekableslider.cpp
seekableslider.h
playlistmodel.h
playlistmodel.cpp
singleapplicationmanager.h
singleapplicationmanager.cpp
mainwindow.ui
resources.qrc
# Translation
file (GLOB PMUSIC_TS_FILES languages/*.ts)
set (PMUSIC_CPP_FILES_FOR_I18N ${PMUSIC_CPP_FILES} ${PMUSIC_UI_FILES})
# 3rd party code
FlacPic.h
ID3v2Pic.h
qt5_create_translation(PMUSIC_QM_FILES ${PMUSIC_CPP_FILES_FOR_I18N} ${PMUSIC_TS_FILES})
add_executable(${EXE_NAME}
${PMUSIC_HEADER_FILES}
${PMUSIC_CPP_FILES}
${PMUSIC_UI_FILES}
resources.qrc
# 3rd party code
FlacPic.h
ID3v2Pic.h
${PMUSIC_QM_FILES}
)
if (NOT TagLib_FOUND)

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWindow</name>
<message>
<source>Mono</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Stereo</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 Channels</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select songs to play</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio Files</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<source>File list.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>MainWindow</name>
<message>
<source>Mono</source>
<translation></translation>
</message>
<message>
<source>Stereo</source>
<translation></translation>
</message>
<message>
<source>%1 Channels</source>
<translation>%1 </translation>
</message>
<message>
<source>Select songs to play</source>
<translation></translation>
</message>
<message>
<source>Audio Files</source>
<translation></translation>
</message>
<message>
<source>Pineapple Player</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>^</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No song loaded...</source>
<translation>...</translation>
</message>
<message>
<source>Drag and drop file to load</source>
<translation></translation>
</message>
<message>
<source>0:00</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<source>File list.</source>
<translation></translation>
</message>
</context>
</TS>