Table des matières:

1 - Info

2 - kicad tree for translations:

2.1 - Dictionnary tree:

2.2 - Search path:

2.3 - Files:

3 - Using poedit

3.1 - Installation

3.2 - Préparation de kicad

3.3 - Poedit Configuration

3.4 - Porject Configuration:

3.5 - Path and files Configuration:

3.6 - Keyword Configuration:

3.7 - Save the procjet:

4 - Create or edit a dictionnary:

5 - Adding a new language entry in kicad

5.1 - Steps:

5.1.1 - Adding a new id in include/id.h.

5.1.2 - Adding a new icon (aesthetic purpose only)

5.1.3 - Editing common/edaappl.cpp

5.1.4 - Recompiling

Info

The different menus and tool tips in Kicad are internationalized, and can be easily translated into a local language without modify any source.

the rules are

Ithey are written in english.

All strings which must be translated are written like: _("hello world"), and displayed "hello world" but if a dictionnary is found translated into the locale language before displaying.

A dictionnary english->locale handle translation (one dictionnary by language).

The easier way to create and maintain the dictionnary english->locale is to use, poedit. (www.poedit.org).

Poedit scans kicad sources and allows you to enter translations.

You must download kicad sources and set poedit in order to create translations.

kicad tree for translations:

Dictionnary tree:

The dictionnary will be found by Kicad only if it is in a suitable path:

	The suitable path is kicad/internat/xx, or kicad/internat/xx_yy with: xx = normalised locale indicator (short form) like: fr = france en = english es = spanish pt = portuguese or: xx_yy = normalised locale indicator (long form) like: fr_FR en_GB en_US

Search path:

Dictionnaries and on line help files are searched in this order:

In the path in normalised locale indicator (long form) (kicad/internat/xx_yy)

In the path in normalised locale indicator (short form) (kicad/internat/xx)

And for on line help files search is made in

In the path in normalised locale indicator (long form) (kicad/help/xx_yy)

In the path in normalised locale indicator (short form) (kicad/i help xx)

kicad/help/en

kicad/help/fr.

Note:

The main kicad path in retrievered from the binary path, or (if not found):

under windows:

c:\kicad

d:\kicad

c:\Program Files\kicad

or under linux:

/usr/share/doc/kicad/help" ),/usr/share/kicad

/usr/local/share/kicad),

/usr/local/kicad/share/kicad,

/usr/local/kicad,

Files:

In each directory there are2 files kicad/internat/xx:

internat.po (the dictionnary file

internat.mo (the poedit work file)

Using poedit

Installation

Download and install poedit (www.poedit.org).

Poedit exists under Windows ,Linux and MacOSX.

Download and unzip Kicad sources.

Préparation de kicad

kicad sources: in this example files are in f:/kicad-dev/.

All the string to translate are tagged like _("string to translate").

poedit must search the _ (underscore) symbol to locale these strings.

One must add in kicad kicad the suitable directory for the dictionnary (kicad/internat/xx ).

in this example this directory is kicad/internat/fr.

Poedit Configuration

Run poedit.

Run fichiers/nouveau catalogue.

You must see something like:

Porject Configuration:

Here is the configuration for the french translation:

The source files are in english, so no need to choose something for source code<

Path and files Configuration:

Keyword Configuration:

Only one keyword to enter: _ (underscore) used as tag in source files

Save the procjet:

Save the new projet in kicad/internat/xx with the name internat.po

Create or edit a dictionnary:

Run poedit and load a procjet (here: f:/kicad/internat/fr/internat.po).

Run the command Catalog/update from sources.

New strings (not yet translated) will be dispayed on the top of the window.

Adding a new language entry in kicad

This step in NOT required.

It is usefull only for developpers, and for testing purpose only

In kicad we can force the used language.

It is highly recommended to use the default language.

But because developpers must test installations, a new entry in the language list can be usefull for testing purposes.

Steps:

Adding a new id in include/id.h.

In include/id.h, locate the sequence like:

ID_LANGUAGE_CHOICE,

ID_LANGUAGE_DEFAULT,

ID_LANGUAGE_ENGLISH,

ID_LANGUAGE_FRENCH,

ID_LANGUAGE_SPANISH,

ID_LANGUAGE_GERMAN,

ID_LANGUAGE_RUSSIAN,

ID_LANGUAGE_PORTUGUESE,

ID_LANGUAGE_ITALIAN,

ID_LANGUAGE_SLOVENIAN,

ID_LANGUAGE_HUNGARIAN,

ID_LANGUAGE_POLISH,

ID_LANGUAGE_KOREAN,

ID_LANGUAGE_CATALAN,

ID_LANGUAGE_UNUSED3,

ID_LANGUAGE_UNUSED4,

ID_LANGUAGE_CHOICE_END,

and add a new entry in list (which will be used latter in menus) like:

ID_LANGUAGE_MY_LANGUAGE (one can replace a line like ID_LANGUAGE_UNUSED3 if exists to do that).

Adding a new icon (aesthetic purpose only)

Create a new icon in xpm format: usually the country flag.

Others language icons are in common/bitmaps

This is text like:

/* XPM */

static const char * lang_fr_xpm[] = {

"16 16 5 1",

"	c None",

".	c #000000",

"+	c #0000D2",

"@	c #FFFFFF",

"#	c #F00000",

" ",

" ",

".............. ",

".++++@@@@####. ",

".++++@@@@####. ",

".++++@@@@####. ",

".++++@@@@####. ",

".++++@@@@####. ",

".++++@@@@####. ",

".++++@@@@####. ",

".++++@@@@####. ",

".++++@@@@####. ",

".............. ",

" ",

" ",

" "};

This is a new file like common/bitmaps/Lang_My_language.xpm, starting by something like:

/* XPM */

static const char * lang_my_language_xpm[] = {

"16 16 5 1",

"	c None",

Editing common/edaappl.cpp

locate the text:

#ifdef __WINDOWS__

/* Icons for language choice (only for Windows)*/

#include "Lang_Default.xpm"

#include "Lang_En.xpm"

#include "Lang_Es.xpm"

#include "Lang_Fr.xpm"

#include "Lang_Pt.xpm"

#include "Lang_It.xpm"

#include "Lang_De.xpm"

#include "Lang_Sl.xpm"

#include "Lang_Hu.xpm"

#include "Lang_Po.xpm"

#include "Lang_Ko.xpm"

#include "Lang_Ru.xpm"

#include "Lang_Catalan.xpm"

#endif

and add a line to include the new icon file.

Locate:

/**************************************************/

void WinEDA_App::SetLanguageIdentifier( int menu_id )

/**************************************************/

/* return in m_LanguageId the language id (wxWidgets language identifier)

* from menu id (internal menu identifier)

*/

{

switch( menu_id )

{

case ID_LANGUAGE_ITALIAN:

m_LanguageId = wxLANGUAGE_ITALIAN;

break;

case ID_LANGUAGE_PORTUGUESE:

m_LanguageId = wxLANGUAGE_PORTUGUESE;

break;

case ID_LANGUAGE_RUSSIAN:

m_LanguageId = wxLANGUAGE_RUSSIAN;

break;

case ID_LANGUAGE_GERMAN:

m_LanguageId = wxLANGUAGE_GERMAN;

break;

case ID_LANGUAGE_SPANISH:

m_LanguageId = wxLANGUAGE_SPANISH;

break;

case ID_LANGUAGE_ENGLISH:

m_LanguageId = wxLANGUAGE_ENGLISH;

break;

case ID_LANGUAGE_FRENCH:

m_LanguageId = wxLANGUAGE_FRENCH;

break;

case ID_LANGUAGE_SLOVENIAN:

m_LanguageId = wxLANGUAGE_SLOVENIAN;

break;

case ID_LANGUAGE_HUNGARIAN:

m_LanguageId = wxLANGUAGE_HUNGARIAN;

break;

case ID_LANGUAGE_POLISH:

m_LanguageId = wxLANGUAGE_POLISH;

break;

case ID_LANGUAGE_KOREAN:

m_LanguageId = wxLANGUAGE_KOREAN;

break;

case ID_LANGUAGE_CATALAN:

m_LanguageId = wxLANGUAGE_CATALAN;

break;

default:

m_LanguageId = wxLANGUAGE_DEFAULT;

break;

}

}

and add a new entry like:

case ID_LANGUAGE_MY_LANGUAGE:

m_LanguageId = wxLANGUAGE_MY_LANGUAGE;

break;

wxLANGUAGE_MY_LANGUAGE is the wxWidgets language identifier for the country (see wxWidget doc).

Locate:

/*********************************************************/

wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )

/*********************************************************/

/* Create menu list for language choice.

*/

{

wxMenuItem* item;

if( m_Language_Menu == NULL )

{

m_Language_Menu = new wxMenu;

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_DEFAULT,

_( "Default" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_def_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_ENGLISH,

wxT( "English" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_en_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_FRENCH,

_( "French" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_fr_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_SPANISH,

_( "Spanish" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_es_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_PORTUGUESE,

_( "Portuguese" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_pt_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_ITALIAN,

_( "Italian" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_it_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_GERMAN,

_( "German" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_de_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_SLOVENIAN,

_( "Slovenian" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_sl_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_HUNGARIAN,

_( "Hungarian" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_hu_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_POLISH,

_( "Polish" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_po_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_RUSSIAN,

_( "Russian" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_ru_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_KOREAN,

_( "Korean" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_ko_xpm );

m_Language_Menu->Append( item );

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_CATALAN,

_( "Catalan" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( lang_catalan_xpm );

m_Language_Menu->Append( item );

}

m_Language_Menu->Check( ID_LANGUAGE_CATALAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_KOREAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_RUSSIAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_POLISH, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_HUNGARIAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_SLOVENIAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_ITALIAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_PORTUGUESE, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_GERMAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_SPANISH, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_FRENCH, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_ENGLISH, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_DEFAULT, FALSE );

switch( m_LanguageId )

{

case wxLANGUAGE_CATALAN:

m_Language_Menu->Check( ID_LANGUAGE_CATALAN, TRUE );

break;

case wxLANGUAGE_KOREAN:

m_Language_Menu->Check( ID_LANGUAGE_KOREAN, TRUE );

break;

case wxLANGUAGE_RUSSIAN:

m_Language_Menu->Check( ID_LANGUAGE_RUSSIAN, TRUE );

break;

case wxLANGUAGE_GERMAN:

m_Language_Menu->Check( ID_LANGUAGE_GERMAN, TRUE );

break;

case wxLANGUAGE_FRENCH:

m_Language_Menu->Check( ID_LANGUAGE_FRENCH, TRUE );

break;

case wxLANGUAGE_ENGLISH:

m_Language_Menu->Check( ID_LANGUAGE_ENGLISH, TRUE );

break;

case wxLANGUAGE_SPANISH:

m_Language_Menu->Check( ID_LANGUAGE_SPANISH, TRUE );

break;

case wxLANGUAGE_PORTUGUESE:

m_Language_Menu->Check( ID_LANGUAGE_PORTUGUESE, TRUE );

break;

case wxLANGUAGE_ITALIAN:

m_Language_Menu->Check( ID_LANGUAGE_ITALIAN, TRUE );

break;

case wxLANGUAGE_SLOVENIAN:

m_Language_Menu->Check( ID_LANGUAGE_SLOVENIAN, TRUE );

break;

case wxLANGUAGE_HUNGARIAN:

m_Language_Menu->Check( ID_LANGUAGE_HUNGARIAN, TRUE );

break;

case wxLANGUAGE_POLISH:

m_Language_Menu->Check( ID_LANGUAGE_POLISH, TRUE );

break;

default:

m_Language_Menu->Check( ID_LANGUAGE_DEFAULT, TRUE );

break;

}

if( MasterMenu )

{

ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu, m_Language_Menu,

ID_LANGUAGE_CHOICE, _( "Language" ),

wxT( "For test only, use Default setup for normal use" ),

language_xpm );

}

return m_Language_Menu;

}

In the if block:

if( m_Language_Menu == NULL )

{

...

add something like:

item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_MY_LANGUAGE,

_( "Korean" ), wxEmptyString, wxITEM_CHECK );

SETBITMAPS( my_language_xpm );

m_Language_Menu->Append( item );

in section:

m_Language_Menu->Check( ID_LANGUAGE_CATALAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_KOREAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_RUSSIAN, FALSE );

m_Language_Menu->Check( ID_LANGUAGE_POLISH, FALSE );

Add

m_Language_Menu->Check( ID_LANGUAGE_MY_LANGUAGE, FALSE );

In the case list add:

case wxLANGUAGE_MY_LANGUAGE:

m_Language_Menu->Check( ID_LANGUAGE_MY_LANGUAGE, TRUE );

break;

Recompiling

Obviously, this is the next and last step.

EESchema

2 G.U.I translation	Page 2 / 11

LTIRF

1996-09-02T17:35:00