Linux あれこれ

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

Lubuntu 20.10 にて「Update Notifier」と「Apply Full Upgrade」を独自に国際化〈H107〉

録日: 2021-01-18 更新日: 2021-01-19

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

前回 は「Lubuntu 20.10」にてシステム更新を通知する「Update Notifier」と「Apply Full Upgrade」の日本語化を試しました。そのときは python プログラムの表示文字列を直接日本語に修正するやり方で行いました。

今回は、前回の成果を参考に、python プログラムを独自に国際化対応して翻訳してみました。 そのときの備忘録です。自己責任です。

-

「目次」

-

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

↓ (呼び出し)

-

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

-


参考: gettext による国際化

gettext --- 多言語対応に関する国際化サービス より抜粋:

-

ソースコード: Lib/gettext.py

gettext モジュールは、Python モジュールおよびアプリケーションに国際化(I18N)およびローカリゼーションL10N)サービスを提供します。

-

通常はアプリの中の文字列を _() 関数の呼び出しに包み込んで、翻訳対象候補であることを示します:

print(_('This string will be translated.'))

-


飜訳対象の文字列を抽出するツール:

オリジナルの「GNU gettext」は C と C++ソースコードしかサポートしませんが、拡張版の「xgettext」は python を含めた多くの言語で書かれたコードを読み取り、飜訳できる文字列を見つけます。

python には「pygettext.py」および「msgfmt.py」という名前の pure-python 版プログラムがあります。

「xgettext」や「pygettext」のようなツールは、メッセージカタログである .po ファイルを生成します。

「msgfmt」にてパソコンが読み込みやすい .mo バイナリカタログファイルへとコンパイルされます。 この .mo が gettext モジュールによる実行時の実際の飜訳処理で使われます。

-

pygettext

→「xgettext」の現在のバージョンは、Python を含む多くの言語をサポートしており、 「pygettext」は非推奨になっています。

-

xgettext

groovy (1) xgettext.1.gz

提供: gettext_0.19.8.1-10build1_amd64

xgettext - ソースからgettext 文字列を抽出します

-

「xgettext」でサポートされている言語:
C、C++、ObjectiveC、C#、GCC-source、PO、Shell、「Python」、
Lisp、Java、JavaProperties、JavaScript、awk、Perl、PHP、
EmacsLisp、librep、Scheme、Smalltalk、Tcl、NXStringTable、
RST、YCP、Glade、Lua、Vala、Desktop

→「Python」はありますが、Go 言語は見当たりません。

-

インストールされているかの確認:
$ apt list gettext* | grep インストール済み
:
gettext-base/groovy,now 0.19.8.1-10build1 amd64 [インストール済み、自動]
gettext/groovy,now 0.19.8.1-10build1 amd64 [インストール済み、自動]

$ xgettext --version
xgettext (GNU gettext-tools) 0.19.8.1

$ msgfmt --version
msgfmt (GNU gettext-tools) 0.19.8.1

→インストールされていました。

-

.po ファイルを生成するツール:

ヘルプ表示:

$ xgettext --help

使用法: xgettext [オプション] [入力ファイル]...

与えられた入力ファイルから翻訳可能な文字列を取り出します.

入力ファイルの指定:
  INPUTFILE ...               入力ファイル
  -f, --files-from=FILE       入力ファイルのリストを FILE から取得
  -D, --directory=DIRECTORY   入力ファイルの検索リストに DIRECTORY を追加
入力ファイルが - の場合は標準入力が読み込まれます.

出力ファイルの指定:
  -d, --default-domain=NAME   出力に NAME.po を使用 (message.po の代わり)
  -o, --output=FILE           指定されたファイルに出力
  -p, --output-dir=DIR        ディレクトリ DIR にファイルを出力
出力ファイルが - の場合は標準出力に結果が書き出されます.

入力ファイル言語の選択:
  -L, --language=NAME         指定された言語を認識
                                (C, C++, ObjectiveC, PO, Shell, Python, Lisp,
                                EmacsLisp, librep, Scheme, Smalltalk, Java,
                                JavaProperties, C#, awk, YCP, Tcl, Perl, PHP,
                                GCC-source, NXStringTable, RST, Glade, Lua,
                                JavaScript, Vala, Desktop)

標準で言語は入力ファイルの拡張子で識別されます.
標準では, 入力ファイルは ASCII と仮定されます.

言語指定オプション:

  -kWORD, --keyword=WORD      追加キーワードとして WORD を検索
  -k, --keyword               標準のキーワードは使わない

:(省略)

-

.mo ファイルにコンパイルするツール:

ヘルプ表示:

$ msgfmt --help

使用法: msgfmt [オプション] filename.po ...

バイナリメッセージカタログを原文の翻訳の記述から生成.

入力ファイルの指定:
  filename.po ...             入力ファイル
  -D, --directory=DIRECTORY   入力ファイルの検索リストに DIRECTORY を追加
入力ファイルが - の場合は標準入力が読み込まれます.

出力ファイルの指定:
  -o, --output-file=FILE      指定したファイルに出力
      --strict                厳密な Uniforum モードを有効に
出力ファイルが - の場合は標準出力に結果が書き出されます.

:(省略)

-


Lubuntu 20.10 にも国際化されたアプリがあり、参考になります

実際の使用例:

$ cat /usr/lib/update-notifier/apt_check.py

import gettext
:
def _(msg):
    return gettext.dgettext("update-notifier", msg)

    if upgrades > 0 or security_updates > 0 or esm_updates > 0:
        outstream.write("\n")
        outstream.write(gettext.dgettext("update-notifier",
                                         "To see these additional updates "
                                         "run: apt list --upgradable"))

# 例外処理の中で

    # gettext
    APP = "update-notifier"
    DIR = "/usr/share/locale"
    gettext.bindtextdomain(APP, DIR)
    gettext.textdomain(APP)
:
                      help=_("Show the packages that are "
                             "going to be installed/upgraded"))

翻訳ファイルの在り処:

$ ls /usr/share/locale/ja/LC_MESSAGES/update-notifier.mo
/usr/share/locale/ja/LC_MESSAGES/update-notifier.mo

-


「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 ~/ダウンロード/翻訳/
$ cp /usr/libexec/lubuntu-update-notifier/lubuntu-notifier.py-ORG lubuntu-notifier.py-ORG
$ cp lubuntu-notifier.py-ORG lubuntu-notifier-CHG.py

$ featherpad lubuntu-notifier-CHG.py

ポイント (33 行目に挿入) :

import gettext
gettext.install('lubuntu-notifier2', '/usr/share/locale')

-

2. 先頭のライセンス部分を表示:

$ cat /usr/libexec/lubuntu-update-notifier/lubuntu-notifier.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/>.

-

3. 差分表示の見方:

66,67c68,69                          ←(置換前の行、置換後の行は3行ズレ)
<         lubuntu-notifier.py-ORG(原本のファイル)       ←(置換前)
---
>         lubuntu-notifier-CHG.py(国際化対応したファイル)         ←(置換後)

-

4. 差分を見ながら、修正します:

$ cd ~/ダウンロード/翻訳/             ←(実行不要)
$ diff lubuntu-notifier.py-ORG lubuntu-notifier-CHG.py     ←(実行不要)

32a33,34    ←(32 行目に下記の 2行挿入したので、以降の行がズレます)
> import gettext
> gettext.install('lubuntu-notifier2', '/usr/share/locale')

66,67c68,69
<         self.upgradeBtn = QPushButton("Upgrade")
<         self.closeBtn = QPushButton("Close")
---
>         self.upgradeBtn = QPushButton(_("Upgrade"))
>         self.closeBtn = QPushButton(_("Close"))
86c88
<         self.setWindowTitle("Update Notifier")
---
>         self.setWindowTitle(_("Update Notifier"))

101,103c103,105    ←(分割される位置を翻訳しやすい位置に修正しました)
<             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 = _("There are upgrades available.")
>             text += _(" Do you want to do a system upgrade?\n")
>             text += _("This will mean packages could be upgraded, installed, or removed.")
129c131
<                 text = "Reboot is needed"
---
>                 text = _("Reboot is needed")
132c134
<                 text = text + "\nReboot is needed"    ←(コンパイル時にエラーしないよう改行と分割)
---
>                 text = text + "\n" + _("Reboot is needed")
151c153
<         self.label.setText("Upgrading...")
---
>         self.label.setText(_("Upgrading..."))
166c168
<             text = "Upgrade finished"
---
>             text = _("Upgrade finished")
170c172
<                 text = text + "\n" + "Restart required"
---
>                 text = text + "\n" + _("Restart required")
202c204
<                         help="Define software/app to open for upgrade",
---
>                         help=_("Define software/app to open for upgrade"),
207c209
<                         help="How many upgrades are available",
---
>                         help=_("How many upgrades are available"),
212c214
<                         help="How many security upgrades are available",
---
>                         help=_("How many security upgrades are available"),

→一部、日本語では翻訳しづらい分割になる行と、エラーが発生する行を修正しました。

-

5. 国際化を反映:

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

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

-

6. 「.pot」ファイルを生成

$ cd ~/ダウンロード/翻訳/
$ ls -1 lubuntu-notifier*
lubuntu-notifier-CHG.py
lubuntu-notifier.py-ORG
lubuntu-notifier_ja.py

$ cp lubuntu-notifier-CHG.py lubuntu-notifier.py
$ xgettext lubuntu-notifier.py -o lubuntu-notifier2.pot
$ ls -1 *.pot
lubuntu-notifier2.pot

-

7. 「.pot」ファイルの修正:

$ cd ~/ダウンロード/翻訳/
$ featherpad lubuntu-notifier2.pot

17 行目を修正:

"Content-Type: text/plain; charset=CHARSET\n"

"Content-Type: text/plain; charset=UTF-8\n"

→コード指定していないとコンパイルのときに停止します。

-

8. 「.po」ファイルを編集(翻訳)

$ cd ~/ダウンロード/翻訳/
$ cp lubuntu-notifier2.pot lubuntu-notifier2.po
$ featherpad lubuntu-notifier2.po

→先頭のコメント部は大幅に削除しました。

-

9. 翻訳後の確認:

$ cat lubuntu-notifier2.po

msgid ""
msgstr ""
"POT-Creation-Date: 2021-01-18 18:40+0900\n"
"Last-Translator: FuRuYa7\n"
"Language: Japanese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: lubuntu-notifier.py:68
msgid "Upgrade"
msgstr "アップグレード"

#: lubuntu-notifier.py:69
msgid "Close"
msgstr "閉じる"

#: lubuntu-notifier.py:88
msgid "Update Notifier"
msgstr "アップデートの通知"

#: lubuntu-notifier.py:103
msgid "There are upgrades available."
msgstr "利用可能なアップグレードがあります。"

#: lubuntu-notifier.py:104
msgid " Do you want to do a system upgrade?\n"
msgstr " システムのアップグレードを行いますか?\n"

#: lubuntu-notifier.py:105
msgid "This will mean packages could be upgraded, installed, or removed."
msgstr "パッケージをアップグレード、インストール、または削除できます。"

#: lubuntu-notifier.py:131 lubuntu-notifier.py:134
msgid "Reboot is needed"
msgstr "再起動が必要です"

#: lubuntu-notifier.py:153
msgid "Upgrading..."
msgstr "アップグレードしています..."

#: lubuntu-notifier.py:168
msgid "Upgrade finished"
msgstr "アップグレードが完了しました"

#: lubuntu-notifier.py:172
msgid "Restart required"
msgstr "再起動が必要です"

#: lubuntu-notifier.py:204
msgid "Define software/app to open for upgrade"
msgstr "アップグレードのために開くソフトウェア/アプリを定義します"

#: lubuntu-notifier.py:209
msgid "How many upgrades are available"
msgstr "利用可能なアップグレードの数"

#: lubuntu-notifier.py:214
msgid "How many security upgrades are available"
msgstr "利用可能なセキュリティアップグレードの数"

-

10. 「.mo」ファイルにコンパイル

$ cd ~/ダウンロード/翻訳/
$ msgfmt lubuntu-notifier2.po -o lubuntu-notifier2.mo

→出力ファイル名を指定しないと「messages.mo」になります。

$ ls *.mo
lubuntu-notifier2.mo

-

11. 「.mo」ファイルを配置:

$ cd ~/ダウンロード/翻訳/
$ sudo cp lubuntu-notifier2.mo /usr/share/locale/ja/LC_MESSAGES/

$ ls /usr/share/locale/ja/LC_MESSAGES/lubuntu*
/usr/share/locale/ja/LC_MESSAGES/lubuntu-notifier2.mo

-

12. 再起動

-

13. 確認:

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

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

-

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

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


$ ls -l /usr/libexec/lubuntu-update-notifier/
:
-rwxr-xr-x 1 root root 8144  1月 18 18:55 lubuntu-notifier-CHG.py  ←(国際化対応)
-rwxr-xr-x 1 root root 8144  1月 18 18:40 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

-


「Apply Full Upgrade」の国際化対応

「/usr/bin/lubuntu-upgrader」の国際化対応

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

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

  • 前回は直接、日本語に翻訳しました。今回は国際化にトライします。

-

1. 国際化対応

$ cd ~/ダウンロード/翻訳/
$ cp /usr/bin/lubuntu-upgrader-ORG lubuntu-upgrader-ORG
$ cp lubuntu-upgrader-ORG lubuntu-upgrader-CHG.py

$ featherpad lubuntu-upgrader-CHG.py

ポイント (42 行目に挿入) :

import gettext
gettext.install('lubuntu-upgrader2', '/usr/share/locale')

-

2. 先頭のライセンス部分を表示:

$ cat /usr/bin/lubuntu-upgrader

#!/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/>.

-

3. 差分表示の見方:

69c70     置換前の行、置換後の行
<         lubuntu-upgrader-ORG(原本のファイル)  ←(置換前)
---
>         lubuntu-upgrader-CHG.py(翻訳したファイル)  ←(置換後)

-

4. 差分を見ながら、修正します:

$ cd ~/ダウンロード/翻訳/                                ←(実行不要)
$ diff lubuntu-upgrader-ORG lubuntu-upgrader-CHG.py  ←(実行不要)

42c42,43    ←(42 行目に下記の 2行挿入したので、以降の行がズレてます)
< 
---
> import gettext
> gettext.install('lubuntu-upgrader2', '/usr/share/locale')

69c70
<             self.setWindowTitle('Full Upgrade')
---
>             self.setWindowTitle(_('Full Upgrade'))
84c85
<         self.closeBtn = QPushButton("Close")
---
>         self.closeBtn = QPushButton(_("Close"))
105c106
<         self.setWindowTitle('Upgrade')
---
>         self.setWindowTitle(_('Upgrade'))
129c130
<         self.label.setText("Updating cache...")
---
>         self.label.setText(_("Updating cache..."))
214c215
<         text = "Upgrade finished"
---
>         text = _("Upgrade finished")
218c219
<             text = text + "\n" + "Restart required"
---
>             text = text + "\n" + _("Restart required")

222c223
<             text = text + "\n With some Errors"    ←(コンパイル時にエラーしないよう改行と分割)
---
>             text = text + "\n" + _(" With some Errors")
239c240
<         self.errors.append("Eror Code: " + str(error_code))
---
>         self.errors.append("Error Code: " + str(error_code))
243,244c244,245
<         print("ECode: " + str(error_code) + "\n")
<         print("EDetail: " + error_details + "\n")
---
>         print(_("ECode: ") + str(error_code) + "\n")
>         print(_("EDetail: ") + error_details + "\n")
269c270
<             print("Warning: install transaction not completed successfully:"
---
>             print(_("Warning: install transaction not completed successfully:")
274c275
<         self.label.setText("Update Cache Finished")
---
>         self.label.setText(_("Update Cache Finished"))
291,292c292,293
<         self.label.setText("Status:" + get_status_string_from_enum(status))
<         print("Status:" + get_status_string_from_enum(status) + " " + status
---
>         self.label.setText(_("Status:") + get_status_string_from_enum(status))
>         print(_("Status:") + get_status_string_from_enum(status) + " " + status
313c314
<             print("Status Details:" + details)
---
>             print(_("Status Details:") + details)
345c346
<             print("Warning: install transaction not completed successfully:"
---
>             print(_("Warning: install transaction not completed successfully:")
369,371c370,372
<         text = "Please run this software with administrative rights."
<         text += "To do so, run this program with lxqt-sudo."
<         title = "Need administrative powers"
---
>         text = _("Please run this software with administrative rights.")
>         text += _("To do so, run this program with lxqt-sudo.")
>         title = _("Need administrative powers")
385c386
<                         help="Update Cache Before Upgrade")
---
>                         help=_("Update Cache Before Upgrade"))
390c391
<                         help="Full upgrade same as dist-upgrade")
---
>                         help=_("Full upgrade same as dist-upgrade"))

-

5. 国際化を反映:

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

-

6. 「.pot」ファイルを生成

$ cd ~/ダウンロード/翻訳/
$ ls -1 lubuntu-upgrader*
lubuntu-upgrader-CHG.py
lubuntu-upgrader-ORG
lubuntu-upgrader_ja

$ cp lubuntu-upgrader-CHG.py lubuntu-upgrader.py
$ xgettext lubuntu-upgrader.py -o lubuntu-upgrader2.pot

$ ls -1 *.pot
lubuntu-notifier2.pot
lubuntu-upgrader2.pot

-

7. 「.pot」ファイルの修正:

$ cd ~/ダウンロード/翻訳/
$ featherpad lubuntu-upgrader2.pot

17 行目を修正:

"Content-Type: text/plain; charset=CHARSET\n"

"Content-Type: text/plain; charset=UTF-8\n"

→コード指定していないとコンパイルのときに停止します。

-

8. 「.po」ファイルを編集(翻訳)

$ cd ~/ダウンロード/翻訳/
$ cp lubuntu-upgrader2.pot lubuntu-upgrader2.po

$ featherpad lubuntu-upgrader2.po

→先頭のコメント部は大幅に削除しました。

-

9. 翻訳後の確認:

$ cat lubuntu-upgrader2.po

msgid ""
msgstr ""
"POT-Creation-Date: 2021-01-18 20:19+0900\n"
"Last-Translator: FuRuYa7\n"
"Language: Japanese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: lubuntu-upgrader.py:70
msgid "Full Upgrade"
msgstr "すべてのアップグレード"

#: lubuntu-upgrader.py:85
msgid "Close"
msgstr "閉じる"

#: lubuntu-upgrader.py:106
msgid "Upgrade"
msgstr "アップグレード"

#: lubuntu-upgrader.py:130
msgid "Updating cache..."
msgstr "キャッシュを更新しています..."

#: lubuntu-upgrader.py:215
msgid "Upgrade finished"
msgstr "アップグレードが完了しました"

#: lubuntu-upgrader.py:219
msgid "Restart required"
msgstr "再起動が必要です"

#: lubuntu-upgrader.py:223
msgid " With some Errors"
msgstr " いくつかのエラーがあります"

#: lubuntu-upgrader.py:244
msgid "ECode: "
msgstr "エラーコード: "

#: lubuntu-upgrader.py:245
msgid "EDetail: "
msgstr "エラー詳細: "

#: lubuntu-upgrader.py:270 lubuntu-upgrader.py:346
msgid "Warning: install transaction not completed successfully:"
msgstr "警告: インストール処理が正常に完了していません:"

#: lubuntu-upgrader.py:275
msgid "Update Cache Finished"
msgstr "キャッシュの更新が完了しました"

#: lubuntu-upgrader.py:292 lubuntu-upgrader.py:293
msgid "Status:"
msgstr "ステータス: "

#: lubuntu-upgrader.py:314
msgid "Status Details:"
msgstr "詳細なステータス: "

#: lubuntu-upgrader.py:370
msgid "Please run this software with administrative rights."
msgstr "このソフトウェアは管理者権限で実行してください。"

#: lubuntu-upgrader.py:371
msgid "To do so, run this program with lxqt-sudo."
msgstr "そのためには、このプログラムをlxqt-sudo を使い実行します。"

#: lubuntu-upgrader.py:372
msgid "Need administrative powers"
msgstr "管理者権限が必要です"

#: lubuntu-upgrader.py:386
msgid "Update Cache Before Upgrade"
msgstr "アップグレード前にキャッシュを更新します"

#: lubuntu-upgrader.py:391
msgid "Full upgrade same as dist-upgrade"
msgstr "dist-upgrade と同じ完全アップグレード"

-

10. 「.mo」ファイルにコンパイル

$ cd ~/ダウンロード/翻訳/
$ msgfmt lubuntu-upgrader2.po -o lubuntu-upgrader2.mo

→出力ファイル名を指定しないと「messages.mo」になります。

$ ls -1 *.mo
lubuntu-notifier2.mo
lubuntu-upgrader2.mo

-

11. 「.mo」ファイルを配置:

$ cd ~/ダウンロード/翻訳/
$ sudo cp lubuntu-upgrader2.mo /usr/share/locale/ja/LC_MESSAGES/

$ ls /usr/share/locale/ja/LC_MESSAGES/lubuntu*
/usr/share/locale/ja/LC_MESSAGES/lubuntu-notifier2.mo
/usr/share/locale/ja/LC_MESSAGES/lubuntu-upgrader2.mo

→2つの.mo ファイルが追加されました。

-

12. 再起動

-

13. 確認:

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

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

-

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

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

$ ls -l /usr/bin/lubuntu-upgrader*
-rwxr-xr-x 1 root root 16566  1月 18 20:09 /usr/bin/lubuntu-upgrader           ←(実行ファイル)
-rwxr-xr-x 1 root root 16566  1月 18 20:45 /usr/bin/lubuntu-upgrader-CHG.py    ←(国際化対応)
-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        ←(直接日本語化)

-

-


まとめ

「Update Notifier」と「Apply Full Upgrade」の国際化にトライしてみました。他のアプリとの兼ね合いもあるし、やり方も色々で迷ってしまいます。個人的なやり方ですが日本語化できました。

アプリを国際化に対応させ翻訳ファイルを準備することで、その後の翻訳の敷居を低くできたと思います。

-

追記:

ネットで確認するとGitHub で国際化は進んでいるようです:

lubuntu-team/lubuntu-update-notifier - GitHub

→当然ながらやり方も翻訳対象の文字列も違います。二度手間なので早く気付けば良かったですね。ドメイン名が重なるので念の為、こちら側を修正しました。

たぶん、しばらくすれば正式な国際化に対応したバージョンに更新されるのではと思います。

-

-


目次

先頭

-


-