0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ubuntuの翻訳ファイル変更方法

Posted at

はじめに

デスクトップに表示されている”ゴミ箱”の名前を変更したいと思い、
翻訳情報を持つファイル(以下、翻訳ファイル)を変更することで成功したので、
翻訳ファイルの変更方法を備忘録として残しておきます。

変更するファイルの在り処

/usr/share/locale/ja/LC_MESSAGES

または、

/usr/share/locale-langpack/ja/LC_MESSAGES

このディレクトリ下にある、アプリ名.moファイルが各アプリの翻訳ファイル。

やり方

.moファイルを.poファイルに変換

.moファイルはバイナリ形式なので、以下のコマンドで編集可能な.poファイルに変更します。

sudo msgunfmt XXXX.mo -o XXXX.po

.poファイルを編集

.poファイル内では、翻訳する言葉をしめすmsgidと翻訳結果であるmsgstrがセットで保存されています。
翻訳の結果を変更するには、msgstrを書き換えます。

.poを.moに変換

# バックアップを取る
sudo cp XXXX.mo XXXX.mo.org
# 先程編集した.poファイルで新しくXXXX.moを作成し、もともとのXXXX.moファイルに上書きする
sudo msgfmt XXXX.po -o XXXX.mo

以上です。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?