Translation
Content
- Install a new translation for HBasic
- Select as default language in Options dialog and restart HBasic or
add new translator online ??
Code to start translation for Qt code
if ( translator )
{
qApp->removeTranslator( translator
);
delete translator;
}
translator = new QTranslator( 0 );
translator->load( lang, "." );
qApp->installTranslator( translator );
Steps to create or compile a new translation
Preparation steps in source code
- Insert macro tr( "..." ) into source files for string constants
- Insert files and translation into hbasic.pro file
Each source file which uses the QT translation macros must be listed in the
project file <HBASICDIR>/translate/hbasic.pro.
Insert new translation language in translation list in this file
TRANSLATIONS = hbasic_de.ts
Prepare <language.ts> file with "make prepare" in translation directory.
Edit file or start $QTDIR/bin/linguist and load file from translate
directory to edit translation for new language.
Create translation object file.
make
Prepare Hbasic for a new translation
Insert new line into install_dir/translate.info
German|german_flag.xpm|hbasic_de.qm
Each translation needs 3 entries in a separate line
- Name of language
- Name of flag picture in translate directory
- Name of translation object file in translate directory
make install
How to translate HBasic strings
Insert tr(x) or QObject::tr(x) for every text x in a sourcefile *.cpp
Edit project file in <HBASICHOME>/translate/hbasic.pro
insert a reference to all *.h and *.cpp files in the project.
Execute "make prepare" in <HBASICHOME>/translate to create *.ts file
for each language
Edit *.ts file with program linguist from Qt or manually
Execute make in translate directory
Execute "make install" or copy new lang.qm file to /usr/local/hbasic/translation
directory.
Insert new languages into HBASICHOME/install_dir/translate.info