登録日: 2020-05-11 更新日: 2020-05-15
公開されたばかりの「Lubuntu 20.04 LTS」をUSB メモリにインストールしました。
新しく、システム更新を通知するアプリが登場しました。それに伴い、メニューからも手動でシステム更新のアプリが起動できます。便利になりましたが日本語化はまだのようです。翻訳してみました。その備忘録です。当然ながら自己責任です。
-
-
「Apply Full Upgrade」アプリの日本語化
システム更新をメニューから手動で起動できると、自分の空いた時間に実行できるメリットがあります。
設定→「Apply Full Upgrade」→「Full Upgrade」画面

→日本語化されていません。
-
デスクトップファイルで確認:
$ cat /usr/share/applications/upg-apply.desktop [Desktop Entry] Exec=lxqt-sudo /usr/bin/lubuntu-upgrader --cache-update --full-upgrade Name=Apply Full Upgrade GenericName=Apply Full Upgrade Comment=Search and Apply Full Upgrade Icon=system-software-update :
→プログラムは「lubuntu-upgrader」のようです。
-
メインメニューの日本語化
デスクトップファイルを修正:
$ sudo featherpad /usr/share/applications/upg-apply.desktop
↓ 下記の2行をお尻に追加:
Name[ja]=すべてのアップグレードの適用 Comment[ja]=すべてのアップグレードの検索と適用
ログアウト→ログイン
-
「lubuntu-upgrader」の日本語化
プログラムは「Python 3」スクリプトで書かれています。国際化されていません。翻訳するなら、プログラムの更新があることを考えるとプログラムを国際化に対応させて(他の国の人も)翻訳しやすくするのがベターです。自分で国際化対応にするなら「/usr/lib/update-notifier/apt_check.py」が参考になりそうです。ですが、python のスキル不足です。
主な表示を直接、日本語に翻訳してみました。(禁じ手かな)
-
1. 原本の退避:
$ 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
→動作に支障が出ないように、下記のように安全と思われる部分だけを翻訳しました。
-
if のある行は、条件判断用の文字列なので、翻訳しません。
-
「 print( 」で検索:
- 「
print(*)"」の行の中は翻訳。
243行:
print("ECode: " + str(error_code) + "\n")
print("EDetail: " + error_details + "\n")
↓
print("エラーコード: " + str(error_code) + "\n")
print("エラー詳細: " + error_details + "\n")
-
269行:
print("Warning: install transaction not completed successfully:"
↓
print("警告: インストール処理が正常に完了していません:"
-
292行:
print("Status:" + get_status_string_from_enum(status) + " " + status
↓
print("ステータス: " + get_status_string_from_enum(status) + " " + status
-
313行:
print("Status Details:" + details)
↓
print("詳細なステータス: " + details)
-
345行:
print("Warning: install transaction not completed successfully:"
↓
print("警告: インストール処理が正常に完了していません:"
-
「 Title( 」で検索:
- 「
self.set*Title('*')」はタイトル名なので翻訳。
69行:
self.setWindowTitle('Full Upgrade')
↓
self.setWindowTitle('すべてのアップグレード')
-
105行:
self.setWindowTitle('Upgrade')
↓
self.setWindowTitle('アップグレード')
-
「 text = 」で検索:
- 「
text =」の行は文字列の代入文なので翻訳。
214行:
text = "Upgrade finished"
↓
text = "アップグレードが完了しました"
-
218行:
text = text + "\n" + "Restart required"
↓
text = text + "\n" + "再起動が必要です"
-
222行:
text = text + "\n With some Errors"
↓
text = text + "\n いくつかのエラーがあります"
-
369行:
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 = "管理者権限が必要"
-
「 " 」で検索:
- 「""」で囲った文字列は翻訳。
84行:
self.closeBtn = QPushButton("Close")
↓
self.closeBtn = QPushButton("閉じる")
-
129行:
self.label.setText("Updating cache...")
↓
self.label.setText("キャッシュを更新しています...")
-
274行:
self.label.setText("Update Cache Finished")
↓
self.label.setText("キャッシュの更新が完了しました")
-
3. 最終的な確認で、日本語化できそうな部分を修正
→「 Status: 」で検索
291行:
self.label.setText("Status:" + get_status_string_from_enum(status))
↓
self.label.setText("ステータス: " + get_status_string_from_enum(status))
-
4. ついでに、タイプ漏れの訂正
239行:
self.errors.append("Eror Code: " + str(error_code))
↓
self.errors.append("Error Code: " + str(error_code))
-
5. 反映:
- スクリプトなので、そのままコピーするだけです。
$ sudo cp ~/ダウンロード/翻訳/lubuntu-upgrader_ja /usr/bin/lubuntu-upgrader
-
6. 確認:
再起動
設定→「すべてのアップグレードの適用」→「すべてのアップグレード」画面

→日本語化されていることを確認。
-
動作が確認できたので、更新に備えコピーしました:
$ sudo cp ~/ダウンロード/翻訳/lubuntu-upgrader_ja /usr/bin/lubuntu-upgrader_ja $ ls -l /usr/bin/lubuntu-upgrader* -rwxr-xr-x 1 root root 16711 5月 14 20:15 /usr/bin/lubuntu-upgrader -rwxr-xr-x 1 root root 16429 5月 9 10:29 /usr/bin/lubuntu-upgrader-ORG -rwxr-xr-x 1 root root 16711 5月 14 20:55 /usr/bin/lubuntu-upgrader_ja
→lubuntu-upgrader_ja のサイズ(16711) に着目。lubuntu-upgrader のサイズが変わったら、更新された合図です。 その場合は、コピーで戻すのでなく参考にしての修正を行います。修正しやすいように差分を表示させました。
-
ファイルの差分表示:
$ 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/>.
差分表示:
$ diff /usr/bin/lubuntu-upgrader-ORG /usr/bin/lubuntu-upgrader_ja
69c69
< self.setWindowTitle('Full Upgrade')
---
> self.setWindowTitle('すべてのアップグレード')
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 = "管理者権限が必要"
-
- 差分の見方:
369,371c369,371 ←(左側: 369〜371行が、右側: 369〜371行に変更されています ) < text = "Please run ... ←(左側: 変更前) < text += "To do so, ... ←(左側: 変更前) < title = "Need admi... ←(左側: 変更前) --- > text = "このソフト... →(右側: 変更後) > text += "そのため... →(右側: 変更後) > title = "管理者権限が... →(右側: 変更後)
→左側: lubuntu-upgrader-ORG(原本)、右側: lubuntu-upgrader_ja(翻訳)
-
まとめ
「Apply Full Upgrade」(すべてのアップグレードの適用)アプリの日本語化にて、手動でのシステム更新の開始や終了時の表示がわかりやすくなりました。今のところ、支障ありません。何かあっても、自己責任です。
-
-
目次
-
-