Linux あれこれ

Linux 関連(一部 Windows11 )の備忘録です。

Lubuntu 20.10 にて「Update Notifier」と「Apply Full Upgrade」を日本語に翻訳〈H106〉

登録日: 2021-01-16 更新日: 2021-01-21

「Lubuntu 20.10」をUSB メモリにインストール しました。

システム更新を通知する「Update Notifier」アプリが登場して便利になっていますが日本語化されていません。

-

以前も「Lubuntu 20.04」にて 「Update Notifier」「Apply Full Upgrade」 の日本語化の投稿をしたことがあります。

-

今回は「Lubuntu 20.10」にて「Update Notifier」と「Apply Full Upgrade」の日本語化を試してみました。 そのときの備忘録です。自己責任です。

-

「目次」

-

日本語化された「Update Notifier」画面:

-

日本語化された「Apply Full Upgrade」画面:

-


メインメニューの日本語化

デスクトップファイルを修正:

$ sudo featherpad /usr/share/applications/upg-apply.desktop

↓ 下記の2行をお尻に追加:

Name[ja]=すべてのアップグレードの適用 (Apply Full Upgrade)
Comment[ja]=すべてのアップグレードの検索と適用

ログアウト→ログイン

-

ちなみに、

Exec=lxqt-sudo /usr/bin/lubuntu-upgrader --cache-update --full-upgrade
Name=Apply Full Upgrade

-


「Update Notifier」の日本語化

「/usr/libexec/lubuntu-update-notifier/lubuntu-notifier.py」の日本語化

  • ファイルの配置や内容がLubuntu 20.04 とは少し変わっています。

  • Lubuntu 20.10 では、定期的に自動でシステム更新があるかをチェック、システム更新があると「/usr/libexec/lubuntu-update-notifier/lubuntu-notifier.py」から「/usr/bin/lubuntu-upgrader」が呼び出されて、更新を実行するかダイアログが表示されます。

  • プログラムは「Python 3」スクリプトで書かれており、国際化されていません。

  • 直接、日本語に翻訳しました。(できたら国際化したいところです)

「Update Notifier」画面 →「アップデートの通知」画面 に翻訳されます。

-

1. 原本の退避:

$ cd /usr/libexec/lubuntu-update-notifier/
$ sudo cp lubuntu-notifier.py lubuntu-notifier.py-ORG

$ ls -l /usr/libexec/lubuntu-update-notifier/
:
-rwxr-xr-x 1 root root 8025  8月 19 23:23 lubuntu-notifier.py
-rwxr-xr-x 1 root root 8025  1月 16 21:53 lubuntu-notifier.py-ORG
-rwxr-xr-x 1 root root 1217  8月 19 23:23 lubuntu-upg-notifier.sh

-

2. 翻訳作業:

$ cd ~/ダウンロード/
$ mkdir 翻訳

$ cd /usr/libexec/lubuntu-update-notifier/
$ cp lubuntu-notifier.py ~/ダウンロード/翻訳/lubuntu-notifier_ja.py

$ featherpad ~/ダウンロード/翻訳/lubuntu-notifier_ja.py

→安全と思われる部分だけを翻訳しました。

-

ファイルの差分表示:

先頭のライセンス部分を表示しておきます:

$ cat /usr/libexec/lubuntu-update-notifier/lubuntu-notifier_ja.py

#!/usr/bin/python3
# coding=utf-8

# Copyright (C) 2019 Hans P. Möller <hmollercl@lubuntu.me>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

-

差分表示の見方:
66,67c66,67                          ←(置換前の行、置換後の行)
<         lubuntu-notifier.py-ORG(原本のファイル)       ←(置換前)
---
>         lubuntu-notifier.py(翻訳したファイル)         ←(置換後)

-

差分表示:
$ cd /usr/libexec/lubuntu-update-notifier/             ←(実行不要)
$ diff lubuntu-notifier.py-ORG lubuntu-notifier.py     ←(実行不要)

66,67c66,67                         ←(66 と 67 行目を置換、66 と 67 行目の結果)
<         self.upgradeBtn = QPushButton("Upgrade")       ←(66 行目 の置換前)
<         self.closeBtn = QPushButton("Close")           ←(67 行目 の置換前)
---
>         self.upgradeBtn = QPushButton("アップグレード")  ←(66 行目 の置換後)
>         self.closeBtn = QPushButton("閉じる")           ←(67 行目 の置換後)
86c86
<         self.setWindowTitle("Update Notifier")
---
>         self.setWindowTitle("アップデートの通知")
101,103c101,103
<             text = "There are upgrades available. Do you want to do a system"
<             text += " upgrade?\nThis will mean packages could be upgraded,"
<             text += " installed, or removed."
---
>             text = "利用可能なアップグレードがあります。"
>             text += "システムのアップグレードを行いますか? \nパッケージ"
>             text += "をアップグレード、インストール、または削除できます。"
129c129
<                 text = "Reboot is needed"
---
>                 text = "再起動が必要です"
132c132
<                 text = text + "\nReboot is needed"
---
>                 text = text + "\n再起動が必要です"
151c151
<         self.label.setText("Upgrading...")
---
>         self.label.setText("アップグレードしています...")
166c166
<             text = "Upgrade finished"
---
>             text = "アップグレードが完了しました"
170c170
<                 text = text + "\n" + "Restart required"
---
>                 text = text + "\n" + "再起動が必要です"
202c202
<                         help="Define software/app to open for upgrade",
---
>                         help="アップグレードのために開くソフトウェア/アプリを定義します",
207c207
<                         help="How many upgrades are available",
---
>                         help="利用可能なアップグレードの数",
212c212
<                         help="How many security upgrades are available",
---
>                         help="利用可能なセキュリティアップグレードの数",

-

3. 反映:

スクリプトなのでコピーするだけです。

$ cd /usr/libexec/lubuntu-update-notifier/
$ sudo cp ~/ダウンロード/翻訳/lubuntu-notifier_ja.py lubuntu-notifier.py

-

4. 確認:

再起動

作業中に、システム更新の通知があったら、システム更新せずに閉じておきます。そうすれば、再起動してすぐか、 1時間ほどで通知のダイアログが表示されると思います。

→日本語化されていることを確認。

-

動作が確認できたので、次のプログラム更新に備えコピーしました:

$ cd /usr/libexec/lubuntu-update-notifier/
$ sudo cp ~/ダウンロード/翻訳/lubuntu-notifier_ja.py lubuntu-notifier_ja.py

$ ls -l /usr/libexec/lubuntu-update-notifier/
:
-rwxr-xr-x 1 root root 8284  1月 16 22:11 lubuntu-notifier.py
-rwxr-xr-x 1 root root 8025  1月 16 21:53 lubuntu-notifier.py-ORG
-rwxr-xr-x 1 root root 8284  1月 16 22:23 lubuntu-notifier_ja.py
-rwxr-xr-x 1 root root 1217  8月 19 23:23 lubuntu-upg-notifier.sh

→lubuntu-notifier_ja.py のサイズ(8284) に着目。lubuntu-notifier.py のサイズが変わったら、更新された合図です。 その場合は、コピーで戻すのでなく参考にしての修正を行います。

-


「Apply Full Upgrade」の日本語化

「/usr/bin/lubuntu-upgrader」の日本語化

  • ファイルの配置や内容はLubuntu 20.04 と変わっていません。

  • プログラムは「Python 3」スクリプトで書かれており、国際化されていません。

  • 直接、日本語に翻訳しました。(できたら国際化したいところです)

-

1. 原本「/usr/bin/lubuntu-upgrader」の退避:

$ sudo cp /usr/bin/lubuntu-upgrader /usr/bin/lubuntu-upgrader-ORG
$ ls -l /usr/bin/lubuntu-upgrader*
-rwxr-xr-x 1 root root 16429  8月 23  2019 /usr/bin/lubuntu-upgrader
-rwxr-xr-x 1 root root 16429  5月  9 10:29 /usr/bin/lubuntu-upgrader-ORG

-

2. 翻訳作業:

$ cp /usr/bin/lubuntu-upgrader ~/ダウンロード/翻訳/lubuntu-upgrader_ja
$ featherpad ~/ダウンロード/翻訳/lubuntu-upgrader_ja

→安全と思われる部分だけを翻訳しました。

  • 下記のファイルの差分表示を見ながら、行番号を目安に修正します。

-

3. ファイルの差分表示:

先頭のライセンス部分を表示しておきます:

$ cat /usr/bin/lubuntu-upgrader-ja

#!/usr/bin/python3
# coding=utf-8

# Copyright (C) 2019 Hans P. Möller <hmollercl@lubuntu.me>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

-

差分表示の見方:
69c69     置換前の行、置換後の行
<         lubuntu-upgrader-ORG(原本のファイル)  ←(置換前)
---
>         lubuntu-upgrader_ja(翻訳したファイル)  ←(置換後)

-

差分表示:
$ diff /usr/bin/lubuntu-upgrader-ORG /usr/bin/lubuntu-upgrader_ja  ←(実行不要)

69c69                                        ←(69 行目 を置換、69 行目の結果)
<             self.setWindowTitle('Full Upgrade')        ←(69 行目 の置換前)
---
>             self.setWindowTitle('すべてのアップグレード')  ←(69 行目 の置換後)
84c84
<         self.closeBtn = QPushButton("Close")
---
>         self.closeBtn = QPushButton("閉じる")
105c105
<         self.setWindowTitle('Upgrade')
---
>         self.setWindowTitle('アップグレード')
129c129
<         self.label.setText("Updating cache...")
---
>         self.label.setText("キャッシュを更新しています...")
214c214
<         text = "Upgrade finished"
---
>         text = "アップグレードが完了しました"
218c218
<             text = text + "\n" + "Restart required"
---
>             text = text + "\n" + "再起動が必要です"
222c222
<             text = text + "\n With some Errors"
---
>             text = text + "\n いくつかのエラーがあります"
239c239
<         self.errors.append("Eror Code: " + str(error_code))
---
>         self.errors.append("Error Code: " + str(error_code))
243,244c243,244
<         print("ECode: " + str(error_code) + "\n")
<         print("EDetail: " + error_details + "\n")
---
>         print("エラーコード: " + str(error_code) + "\n")
>         print("エラー詳細: " + error_details + "\n")
269c269
<             print("Warning: install transaction not completed successfully:"
---
>             print("警告: インストール処理が正常に完了していません:"
274c274
<         self.label.setText("Update Cache Finished")
---
>         self.label.setText("キャッシュの更新が完了しました")
291,292c291,292
<         self.label.setText("Status:" + get_status_string_from_enum(status))
<         print("Status:" + get_status_string_from_enum(status) + " " + status
---
>         self.label.setText("ステータス: " + get_status_string_from_enum(status))
>         print("ステータス: " + get_status_string_from_enum(status) + " " + status
313c313
<             print("Status Details:" + details)
---
>             print("詳細なステータス: " + details)
345c345
<             print("Warning: install transaction not completed successfully:"
---
>             print("警告: インストール処理が正常に完了していません:"
369,371c369,371
<         text = "Please run this software with administrative rights."
<         text += "To do so, run this program with lxqt-sudo."
<         title = "Need administrative powers"
---
>         text = "このソフトウェアは管理者権限で実行してください。"
>         text += "そのためには、このプログラムをlxqt-sudo を使い実行します。"
>         title = "管理者権限が必要"

-

4. 反映:

$ sudo cp ~/ダウンロード/翻訳/lubuntu-upgrader_ja /usr/bin/lubuntu-upgrader

-

5. 確認:

再起動

設定→「すべてのアップグレードの適用」→「すべてのアップグレード」画面

→日本語化されていることを確認。

-

6. 動作が確認できたので、更新に備えコピーしました:

$ sudo cp ~/ダウンロード/翻訳/lubuntu-upgrader_ja /usr/bin/lubuntu-upgrader_ja

$ ls -l /usr/bin/lubuntu-upgrader*
-rwxr-xr-x 1 root root 16708  1月 16 00:54 /usr/bin/lubuntu-upgrader
-rwxr-xr-x 1 root root 16429  1月 16 00:16 /usr/bin/lubuntu-upgrader-ORG
-rwxr-xr-x 1 root root 16708  1月 16 00:56 /usr/bin/lubuntu-upgrader_ja

→lubuntu-upgrader_ja のサイズ(16708) に着目。lubuntu-upgrader のサイズが変わったら、更新された合図です。 その場合は、コピーで戻すのでなく参考にしての修正を行います。修正しやすいように差分を表示させました。

-

-


まとめ

「Update Notifier」と「Apply Full Upgrade」が日本語化され、システム更新の表示がわかりやすくなりました。

(英語のままでも支障はありません…。だから国際化が進んでいないのでしょうね)

アプリが国際化に対応することで、どこの国でも翻訳しやすくなるといいですね。

-

-


目次

先頭

-


-