View Single Post
Posts: 85 | Thanked: 383 times | Joined on Jan 2010 @ Hong Kong
#2
With some testing, I think I know the answer now...localized application name shown in application icon is defined by using *.mo file.

For example, we define a /usr/share/applications/hildon/MyApp.desktop file with the following contents:

Code:
[Desktop Entry]
Encoding=UTF-8
Version=0.1
Name=MyAppName
Comment=My App
Exec=python /opt/MyApp/MyApp.py
Icon=MyApp
Type=Application
X-HildonDesk-ShowInToolbar=true
X-Text-Domain=MyApp
Then we will need to prepare localized .po files (take zh_HK.po as example) with the following contents:

Code:
msgid ""
msgstr ""
"Project-Id-Version: MyApp\n"
"Report-Msgid-Bugs-To: my-email@my-email.com\n"
"POT-Creation-Date: 2010.05.16 14:11+0300\n"
"PO-Revision-Date: 2010-06-21 12:26+0800\n"
"Last-Translator: My Name <my-email@my-email.com>n"
"Language-Team: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1\n"

msgid "MyAppName"
msgstr "好程式"

Use the msgfmt tool to generate the .mo file and place the .mo file to the corresponding locale directory:

Code:
msgfmt zh_HK.po -o /usr/share/locale/zh_HK/LC_MESSAGES/MyApp.mo
Please note that the "MyApp" in the .mo filename must be the same as the value specified in the X-Text-Domain section of the .desktop file.

Don't forget to prepare two PNG images, one with 48x48 and one with 64x64 resolution, and place them to:

Code:
/usr/share/icons/hicolor/48x48/apps/MyApp,png  (48x48)

/usr/share/icons/hicolor/scalable/hildon/MyApp.png  (64x64)
And that's it. You will see "好程式" as the application name when you switch to the zh_HK locale

Last edited by amandalam; 2010-06-23 at 01:20.
 

The Following 3 Users Say Thank You to amandalam For This Useful Post: