Skip to content

Commit

Permalink
i18n: support translation for the widgets version
Browse files Browse the repository at this point in the history
  • Loading branch information
BLumia committed Aug 15, 2024
1 parent 6eebc7f commit ec2f87e
Show file tree
Hide file tree
Showing 12 changed files with 799 additions and 126 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.8)

project(pineapple-tracker-player VERSION 0.2 LANGUAGES CXX)

# https://forum.qt.io/topic/155823/cmake-does-not-work-with-qt-6-7-0
# https://bugreports.qt.io/browse/QTBUG-126167
find_package(Qt6 REQUIRED COMPONENTS Core LinguistTools)

add_subdirectory(player)
add_subdirectory(widget)
add_subdirectory(quick)
20 changes: 8 additions & 12 deletions quick/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@ QML_FILES
components/InstrumentItem.qml
)

# https://forum.qt.io/topic/155823/cmake-does-not-work-with-qt-6-7-0
# https://bugreports.qt.io/browse/QTBUG-126167
if (Qt6LinguistTools_VERSION VERSION_LESS 6.7.0 OR Qt6LinguistTools_VERSION VERSION_GREATER 6.7.2)
qt_add_translations(pineapple-tracker-player-quick
TS_FILES
translations/pineapple-tracker-player.ts
translations/pineapple-tracker-player_nl.ts
translations/pineapple-tracker-player_pl.ts
translations/pineapple-tracker-player_tr.ts
translations/pineapple-tracker-player_zh_CN.ts
)
endif()
qt_add_translations(pineapple-tracker-player-quick
TS_FILES
translations/pineapple-tracker-player.ts
translations/pineapple-tracker-player_nl.ts
translations/pineapple-tracker-player_pl.ts
translations/pineapple-tracker-player_tr.ts
translations/pineapple-tracker-player_zh_CN.ts
)

qt_add_resources(pineapple-tracker-player-quick resources.qrc
PREFIX "/icons"
Expand Down
21 changes: 14 additions & 7 deletions quick/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,19 @@ ApplicationWindow {
player.isPlaying ? player.pause() : player.play()
}
}
SpinBox {
value: player.repeatCount
from: 0
to: 99
onValueChanged: {
player.repeatCount = value
Button {
property bool replayMode: false
text: replayMode ? qsTr("Replay") : qsTr("Repeat")
onClicked: {
replayMode = !replayMode
if (replayMode) {
// replay
player.repeatCount = 1
player.restartAfterFinished = true
} else {
// repeat
player.repeatCount = 0
}
}
}

Expand All @@ -111,7 +118,7 @@ ApplicationWindow {
}
Slider {
id: gainSlider
from: -1500
from: -2000
to: 1000
value: player.gain
onMoved: () => {
Expand Down
173 changes: 151 additions & 22 deletions quick/translations/pineapple-tracker-player.ts
Original file line number Diff line number Diff line change
@@ -1,75 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWindow</name>
<message>
<location filename="../../widget/mainwindow.ui" line="+17"/>
<source>Pineapple Tracker Player</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+7"/>
<source>Song Title (Drop file to load/play)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+7"/>
<source>Artist (Tracker)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+16"/>
<location filename="../../widget/mainwindow.cpp" line="+60"/>
<source>Play</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+7"/>
<source>Repeat Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<location filename="../../widget/mainwindow.cpp" line="+43"/>
<source>Repeat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+56"/>
<source>Playback Status</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+20"/>
<source>Playlist</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+16"/>
<source>Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+19"/>
<source>Instruments</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+63"/>
<source>Type to filter by keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+43"/>
<source>&amp;File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>&amp;Help</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+12"/>
<source>&amp;Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+11"/>
<location filename="../../widget/mainwindow.cpp" line="+101"/>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../widget/mainwindow.cpp" line="-144"/>
<source>Pause</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+38"/>
<source>Single</source>
<comment>Repeat is disabled, song will only play a single time and will then stopped.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+10"/>
<source>Replay</source>
<comment>Similar to Repeat mode, but the playback is restarted from beginning instead of using the loop point in the module file.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+102"/>
<source>Based on the following free software libraries:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="18"/>
<location/>
<location filename="../main.qml" line="+17"/>
<location filename="../../build/quick/player/main.qml" line="+17"/>
<source>&amp;File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="21"/>
<location/>
<location line="+3"/>
<location filename="../../build/quick/player/main.qml" line="+3"/>
<source>&amp;Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="30"/>
<location/>
<location line="+9"/>
<location filename="../../build/quick/player/main.qml" line="+9"/>
<source>Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="33"/>
<location/>
<location line="+3"/>
<location filename="../../build/quick/player/main.qml" line="+3"/>
<source>Set Mono &amp;Font</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="40"/>
<location/>
<location line="+7"/>
<location filename="../../build/quick/player/main.qml" line="+7"/>
<source>Toggle &amp;Menu Bar Visibility</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="66"/>
<location/>
<location line="+9"/>
<location filename="../../build/quick/player/main.qml" line="+9"/>
<source>&amp;Help</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<location line="+239"/>
<location filename="../../build/quick/player/main.qml" line="+3"/>
<location line="+232"/>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-213"/>
<location filename="../../build/quick/player/main.qml" line="-206"/>
<source>Song Title (Drop file to load/play)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="70"/>
<location/>
<location line="+4"/>
<location filename="../../build/quick/player/main.qml" line="+4"/>
<source>Artist (Tracker)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="84"/>
<location/>
<location line="+14"/>
<location filename="../../build/quick/player/main.qml" line="+14"/>
<source>Pause</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="84"/>
<location/>
<location line="+0"/>
<location filename="../../build/quick/player/main.qml" line="+0"/>
<source>Play</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="115"/>
<location line="+7"/>
<source>Replay</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+0"/>
<source>Repeat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+31"/>
<location filename="../../build/quick/player/main.qml" line="+31"/>
<source>Playback Status</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.qml" line="224"/>
<location/>
<location line="+138"/>
<location filename="../../build/quick/player/main.qml" line="+138"/>
<source>Select module file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.cpp" line="24"/>
<location filename="../../widget/main.cpp" line="+19"/>
<location filename="../main.cpp" line="+25"/>
<source>File list.</source>
<translation type="unfinished"></translation>
</message>
Expand Down
Loading

0 comments on commit ec2f87e

Please sign in to comment.