My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
TranslatingBPBible  
How to translate BPBible
Updated Sep 6, 2012 by jonmmor...@gmail.com

Introduction

BPBible 0.4 adds the ability to translate the user interface. This page details how to do it.

Details

You need to find the abbreviation for your language. This is typically a two letter string (for example, vi for Vietnamese). This may have a country-specific postfix (for example, en_AU would be for Australian English). Note: your language must be supported by wxWidgets.

To find the abbreviation for your language, find the line with your language in resources/iso-639-2.data. It should also have a two letter name (or if it doesn't, try using the three letter - but it may not work).

There are three files you have to edit to translate the BPBible user interface. If you are having difficulty with it, the Vietnamese locale is a good example to copy.

Configuration file

The locale configuration file is where the language is registered with BPBible. This will be put at locales/language_abbrev/locale.conf It can have three sections, as seen in this example (Vietnamese):

[Language]
Description=Vietnamese

[SWORD]
locale=vi
abbreviations=vi_abbrev

[Text]
English=Tiếng Anh
BM test=Kiểm Tra BM
Vietnamese=Tiếng Việt

The SWORD section can have two items, locale and abbreviations. These correspond to the Bible book names files, but without .conf on the end. abbreviations is optional; it defaults to the value of locale.

The Text section is intended to have messages which apply to BPBible but don't have a more widespread application. At the moment, language names go in here.

Application messages

The application messages makes up the bulk of the translation work. To start, copy the messages.pot file in the locales directory and name it language_abbreviation.po. Then edit the file. Poedit will do the editing for you; this should be very easy to use. Go Catalog > Settings to set up the language and name of the project.

There is one special string which needs special consideration: translator-credits. Please use this to provide brief attribution to you for your translation, according to a format something like "Language translation provided by Your Name" or something like that.

When you make changes, you should compile it to see the effects. Running bpbible with a -d flag from the command line (bpbible.exe -d if you are running the compiled executable; python bpbible.py -d otherwise) will give a debug menu. Going Debug > Locale > compile will compile the .po file; using Debug > Locale > restart will restart BPBible to work with the new locale changes. If you don't get a Debug > Locale menu item, you can get Poedit to compile your language file for you. To do this, go to File > Preferences > Editor > Behavior, and make sure that "Automatically compile .mo file on save" is ticked. Then save your .po file, and a .mo file will be created in the same directory. You will need to manually move it from the locales\language_abbreviation.mo directory to locales\language_abbreviation\LC_MESSAGES\messages.mo, and then after reloading the BPBible interface, it should work.

Note: if you do not have the configuration file mentioned above in place, the language will not show up in File > Languages, and it will not compile it.

Special formatting

Sometimes special formatting is used in messages; this needs to be understood to translate the message properly.

%s is used for inserting a string into another one. So for an example,

msgid "Show the %s pane"

Here %s represents the name of the pane (which is defined elsewhere). When displayed to the user, this will be substituted in. %d is similar; it is used for integers.

Another variation is %(name)s. This is used in strings which would need more than one %s, so that they can be reordered.

So for example from the en_AU test locale:

#: swlib/pysw.py:109 swlib/pysw.py:412
msgid "There are only %(chapters)d chapters in %(book)s (given %(given)d)"
msgstr ""
"You seem to think %(book)s has %(given)d chapters, but %(book)s really has %"
"(chapters)d chapters"

This allows rearranging of the order of the inserted strings. You don't need to translate what is inside the brackets (and shouldn't - it will break it), as these are just the identifiers for the string. Also, make sure the letter after the bracket (s or d) is still there - it won't work without this.

& is used for the accelerator in menus and for controls. So &Language would make L the accelerator for Language - it would generally put an underline under the L, and pressing L would go to that item in the menu.

Bible Book names

Lastly, there are the bible book names. You will need to produce a .conf file for the book names, and also for abbreviations if you want them. Before you make one, see if there are any here for your language already. If there are any for your language, download them and use them.

Follow the steps mentioned here to produce a file for use.

NOTE: BPBible allows dashes in booknames. After following the steps from the page above (that is, without dashes in the booknames), add extra entries of the form BookName=Book-Name.

For example, the Vietnamese locale has Mathiơ=Ma-thi-ơ

These files should go in the locales/locales.d folder

Display Menu

There are items in the display menu such as Footnotes, Cross-references, etc. These are translated using the bible book name .conf file above. Under the bible booknames in the Text section, you will need to add strings of the form Footnotes=Notes of foot

So at the end of the list of booknames you may have:

...
Revelation of John=The Apocalypse

Footnotes=Notes of foot
...

The strings you may need to translate are list below.

Hebrew Cantillation
Toggles Hebrew Cantillation Marks
Greek Accents
Toggles Greek Accents
Hebrew Vowel Points
Toggles Hebrew Vowel Points
Textual Variants
Switch between Textual Variants modes
Primary Reading
Secondary Reading
All Readings

Directory Structure

The final directory structure for your language files will look something like this (where language_abbrev is the abbreviation for your language, e.g. "zh_CN" for Simplified Chinese, "vi" for Vietnamese, "de" for German).

  • locales
    • language_abbrev.po
    • locales.d
      • language_abbrev_abbrev.conf
      • language_abbrev.conf
    • language_abbrev
      • locale.conf
      • LC_MESSAGES
        • messages.mo

If you create a zip file with these files in it, this can be extracted onto other installations to install the language.

History and History Toolbar

"History" and "History Toolbar" should not be translated the same. Due to technical restrictions, translating them to the same word(s) will stop the history panel being usable.

Comment by sink...@gmail.com, Jan 12, 2009

I start creating the hungarian translation. Where I can find the messages.pot file in the locales directory? I didn't find it.

Comment by project member benpmor...@gmail.com, Jan 13, 2009

Sorry about this - the built distribution doesn't include this file. Probably the best messages.pot to use is the one out of the latest svn -http://bpbible.googlecode.com/svn/trunk/locales/messages.pot That way some new messages will be there which weren't in 0.4. In case you want to use the one from 0.4, download it from http://bpbible.googlecode.com/svn/tags/release-0.4/locales/messages.pot

When I get time, I'll update this page with instructions on downloading this.

Comment by Spiderma...@gmail.com, Feb 7, 2009

I could help for a french translation. I have a question: usually french language would be 25-30% longer than the english translation. What are the limitation about strings length for the translation? Do they need to be smaller or same size than the original english one? If i understand correctly, the bible book itself don't need to be translated?

Comment by project member benpmor...@gmail.com, Feb 7, 2009

Strings can be longer if you need them to be. The bible books data is already available - the data is at http://www.crosswire.org/ftpmirror/pub/sword/source/sword/locales.d/ under the files fr-utf8.conf and fr_abbrev-utf8.conf

The main page for translators lives at http://bpbible.com/translators - have a look at the instructions there.

Comment by lingam...@gmail.com, Sep 24, 2009

Sorry, Chris. This is too difficult to understand. I created the pt.mo file using poedit and then created a folder called LC_MESSAGES and put that file in there changing it to messages.mo

I can't get BPBible to list Portuguese as an option in the language menu.

Comment by lingam...@gmail.com, Sep 24, 2009

OK, I restarted and it is now showing the menus in Portuguese. Is there a place for uploading language files?

Comment by project member benpmor...@gmail.com, Sep 24, 2009

If you send them to my user id @gmail.com, I can add them. (my user id is benpmorgan)

Comment by lingam...@gmail.com, Sep 24, 2009

I'll work on it a few more days and then send it to you. Thx.

Comment by sma...@gmail.com, Jul 22, 2011

Kannada font is not coming

Comment by project member jonmmor...@gmail.com, Jul 24, 2011

Sorry, I don't know what you mean by "Kannada font is not coming".


Sign in to add a comment
Powered by Google Project Hosting