LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Enable additional language support of FFaudioConverter's GUI menu (https://www.linuxquestions.org/questions/slackware-14/enable-additional-language-support-of-ffaudioconverters-gui-menu-4175735190/)

J_W 03-22-2024 11:42 PM

Enable additional language support of FFaudioConverter's GUI menu
 
4 Attachment(s)
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=Application

002_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.

henca 03-23-2024 04:58 AM

Great work! I really hope that the project maintainers will accept your pull request at
https://github.com/Bleuzen/FFaudioConverter/pull/16/

regards Henrik

J_W 03-25-2024 04:03 PM

Hi, Henrik

Thanks for your comments.
I hope so too. But, upstream of FFaudioConverter git seems to be sleeping since 2 years ago.
So, I think it might be a long shot that my pull request is approved and committed by the maintainer.
That's why I shared my localization method here to other users.

Cheers,
J_W


All times are GMT -5. The time now is 05:01 AM.