Article 6KJAX Enable additional language support of FFaudioConverter's GUI menu

Enable additional language support of FFaudioConverter's GUI menu

by
J_W
from LinuxQuestions.org on (#6KJAX)
Hello,

I'll share how did I enable Japanese localization of FFaudioConverter's GUI menu.
This procedure is quite simple and easy. So,it might be useful for other language users who want to enable their own language menu of FFaudioConverter.

OK. Following how2 is an example of Japanese language case.
Please change "ja / ja_JP" part to your own LANG.

Step-1. Get source
wget https://github.com/Bleuzen/FFaudioCo...-0.31.0.tar.gz

Step-2. Create new message data of my language (ja.ts)
1) Extract the source and pic a base *.ts data from FFaudioConverter-0.31.0/translations/ directory.
(I used de.ts as a base ts.)

2) cp FFaudioConverter-0.31.0/translations/de.ts .
mv de.ts ja.ts

3) Edit Line 3 with a text editor
<TS version="2.1" language="de_DE">
to
<TS version="2.1" language="ja_JP">

4) Tranlate ja.ts into my own language
Qt5-Linguist will be the best tool for creating TS data, but a text editor such as nano is also OK, because translation items are only '49" in case of this application.

[for example]
Code:<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ja_JP">
<context>
<name>AboutDialog</name>
<message>
<location filename="../src/aboutdialog.ui" line="14"/>
<source>About</source>
<translation>FFaudioConverter</translation>
</message>
<message>
<location filename="../src/aboutdialog.ui" line="26"/>
<source>Close</source>
<translation></translation>
</message>
<message>
<location filename="../src/aboutdialog.ui" line="105"/>
<source>About Qt</source>
<translation>Qt</translation>
</message>
<message>
<location filename="../src/aboutdialog.cpp" line="39"/>
<source>developed by</source>
<translation></translation>
</message>
...
...
Step-3. patches

001_FFaudioConverter_Japanese-translation.patch

Please change "ja.ts" part of the patch to your own LANG, for example "it.ts".
(You may change name of this patch as you like.)

Code:diff -Nru a/FFaudioConverter.pro b/FFaudioConverter.pro
--- a/FFaudioConverter.pro 2024-02-12 16:10:31.403639045 +0900
+++ b/FFaudioConverter.pro 2024-02-12 16:10:08.034681049 +0900
@@ -71,6 +71,7 @@
TRANSLATIONS += \
translations/de.ts \
translations/fr.ts \
+ translations/ja.ts \
translations/tr.ts

CONFIG += lrelease
diff -Nru a/com.github.Bleuzen.FFaudioConverter.desktop b/com.github.Bleuzen.FFaudioConverter.desktop
--- a/com.github.Bleuzen.FFaudioConverter.desktop 2024-02-12 16:10:43.008618177 +0900
+++ b/com.github.Bleuzen.FFaudioConverter.desktop 2024-02-12 16:09:53.024708019 +0900
@@ -1,7 +1,9 @@
[Desktop Entry]
Comment=DnD GUI for converting audio files
+Comment[ja]=DnD GUI
Exec=ffaudioconverter %F
Name=FFaudioConverter
+Name[ja]=GUI
Icon=com.github.Bleuzen.FFaudioConverter
StartupNotify=true
Type=Application002_dark-status-color.patch ; This patch is not neccessary.
Code:--- a/src/mainwindow.cpp 2024-02-12 17:51:00.868083373 +0900
+++ b/src/mainwindow.cpp 2024-02-12 17:51:16.343100355 +0900
@@ -171,19 +171,19 @@
{
if(status == FFmpegTask::ConvertStatus::Pending) {
model->setData(index, tr("Pending"));
- model->setData(index, QColor(Qt::yellow), Qt::BackgroundRole);
+ model->setData(index, QColor(Qt::darkYellow), Qt::BackgroundRole);
} else if(status == FFmpegTask::ConvertStatus::Converting) {
model->setData(index, tr("Converting"));
model->setData(index, QColor(Qt::darkYellow), Qt::BackgroundRole);
} else if(status == FFmpegTask::ConvertStatus::Done) {
model->setData(index, tr("Done"));
- model->setData(index, QColor(Qt::green), Qt::BackgroundRole);
+ model->setData(index, QColor(Qt::darkGreen), Qt::BackgroundRole);
} else if(status == FFmpegTask::ConvertStatus::Failed) {
model->setData(index, tr("Failed"));
- model->setData(index, QColor(Qt::red), Qt::BackgroundRole);
+ model->setData(index, QColor(Qt::darkRed), Qt::BackgroundRole);
} else if(status == FFmpegTask::ConvertStatus::Skipped) {
model->setData(index, tr("Skipped"));
- model->setData(index, QColor(Qt::blue), Qt::BackgroundRole);
+ model->setData(index, QColor(Qt::darkBlue), Qt::BackgroundRole);
}
}Step-4. SlackBuild (Diff from SBo's original slackbuild)
Code:--- FFaudioConverter.SlackBuild 2023-04-08 11:20:23.000000000 +0900
+++ FFaudioConverter.SlackBuild.new 2024-03-23 12:45:13.819315587 +0900
@@ -26,7 +26,7 @@

PRGNAM=FFaudioConverter
VERSION=${VERSION:-0.31.0}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

@@ -69,6 +69,14 @@
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
+
+# Apply Japanese translation fix patch
+zcat $CWD/001_FFaudioConverter_Japanese-translation.patch.gz | patch -p1 --verbose || exit 1
+cp $CWD/ja.ts translations/ja.ts
+
+# Fix status colors match to Dark theme
+zcat $CWD/002_dark-status-color.patch.gz | patch -p1 --verbose || exit 1
+
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \I also attached several screenshots.

Hope this would help for some FFaudioConverter's users.
Attached Thumbnailsattachment.php?attachmentid=42640&stc=1&attachment.php?attachmentid=42641&stc=1&attachment.php?attachmentid=42642&stc=1&attachment.php?attachmentid=42643&stc=1&
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments