nobody at rubyforge.org
2006-Nov-26 09:47 UTC
[Wxruby-development] [758] trunk/wxruby2: i18n support: added Locale class, methods for get/set languages & encodings
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:'':'';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[758] trunk/wxruby2: i18n support: added Locale class, methods for get/set languages & encodings</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>758</dd> <dt>Author</dt> <dd>brokentoy</dd> <dt>Date</dt> <dd>2006-11-26 04:47:32 -0500 (Sun, 26 Nov 2006)</dd> </dl> <h3>Log Message</h3> <pre>i18n support: added Locale class, methods for get/set languages & encodings</pre> <h3>Modified Paths</h3> <ul> <li><a href="#trunkwxruby2doctextilefonttxtl">trunk/wxruby2/doc/textile/font.txtl</a></li> <li><a href="#trunkwxruby2doctextilelocaletxtl">trunk/wxruby2/doc/textile/locale.txtl</a></li> <li><a href="#trunkwxruby2samplestextunicoderb">trunk/wxruby2/samples/text/unicode.rb</a></li> <li><a href="#trunkwxruby2swigclassesFonti">trunk/wxruby2/swig/classes/Font.i</a></li> <li><a href="#trunkwxruby2swigclassesincludewxFonth">trunk/wxruby2/swig/classes/include/wxFont.h</a></li> <li><a href="#trunkwxruby2swigclassesincludewxLocaleh">trunk/wxruby2/swig/classes/include/wxLocale.h</a></li> <li><a href="#trunkwxruby2swigtypedefsi">trunk/wxruby2/swig/typedefs.i</a></li> </ul> <h3>Added Paths</h3> <ul> <li><a href="#trunkwxruby2doctextileinternationalizationtxtl">trunk/wxruby2/doc/textile/internationalization.txtl</a></li> <li><a href="#trunkwxruby2libwxclassesfontrb">trunk/wxruby2/lib/wx/classes/font.rb</a></li> <li><a href="#trunkwxruby2libwxclasseslocalerb">trunk/wxruby2/lib/wx/classes/locale.rb</a></li> <li><a href="#trunkwxruby2swigclassesLocalei">trunk/wxruby2/swig/classes/Locale.i</a></li> <li><a href="#trunkwxruby2teststest_intlrb">trunk/wxruby2/tests/test_intl.rb</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="trunkwxruby2doctextilefonttxtl"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/doc/textile/font.txtl (757 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/doc/textile/font.txtl        2006-11-24 17:17:52 UTC (rev 757) +++ trunk/wxruby2/doc/textile/font.txtl        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -16,12 +16,9 @@ </span><span class="cx"> </span><span class="cx"> h2. Constants </span><span class="cx"> </span><del>-The possible values for the family parameter of "Font </del><ins>+The possible constant values for the family parameter of "Font </ins><span class="cx"> constructor":fontctor.html are (the old names are for compatibility only): </span><span class="cx"> </span><del>- - enum FontFamily - { </del><span class="cx"> FONTFAMILY_DEFAULT = DEFAULT, </span><span class="cx"> FONTFAMILY_DECORATIVE = DECORATIVE, </span><span class="cx"> FONTFAMILY_ROMAN = ROMAN, </span><span class="lines">@@ -30,53 +27,39 @@ </span><span class="cx"> FONTFAMILY_MODERN = MODERN, </span><span class="cx"> FONTFAMILY_TELETYPE = TELETYPE, </span><span class="cx"> FONTFAMILY_MAX </span><del>- }; </del><span class="cx"> </span><span class="cx"> </span><span class="cx"> The possible values for the weight parameter are (the old names </span><span class="cx"> are for compatibility only): </span><span class="cx"> </span><del>- - enum FontWeight - { </del><span class="cx"> FONTWEIGHT_NORMAL = NORMAL, </span><span class="cx"> FONTWEIGHT_LIGHT = LIGHT, </span><span class="cx"> FONTWEIGHT_BOLD = BOLD, </span><span class="cx"> FONTWEIGHT_MAX </span><del>- }; - </del><span class="cx"> </span><span class="cx"> The font flags which can be used during the font creation are: </span><span class="cx"> </span><del>- - enum - { - // no special flags: font with default weight/slant/anti-aliasing </del><ins>+ # no special flags: font with default weight/slant/anti-aliasing </ins><span class="cx"> FONTFLAG_DEFAULT = 0, </span><span class="cx"> </span><del>- // slant flags (default: no slant) </del><ins>+ # slant flags (default: no slant) </ins><span class="cx"> FONTFLAG_ITALIC = 1 << 0, </span><span class="cx"> FONTFLAG_SLANT = 1 << 1, </span><span class="cx"> </span><del>- // weight flags (default: medium) </del><ins>+ # weight flags (default: medium) </ins><span class="cx"> FONTFLAG_LIGHT = 1 << 2, </span><span class="cx"> FONTFLAG_BOLD = 1 << 3, </span><span class="cx"> </span><del>- // anti-aliasing flag: force on or off (default: the current system default) </del><ins>+ # anti-aliasing flag: force on or off (default: the current system default) </ins><span class="cx"> FONTFLAG_ANTIALIASED = 1 << 4, </span><span class="cx"> FONTFLAG_NOT_ANTIALIASED = 1 << 5, </span><span class="cx"> </span><del>- // underlined/strikethrough flags (default: no lines) </del><ins>+ # underlined/strikethrough flags (default: no lines) </ins><span class="cx"> FONTFLAG_UNDERLINED = 1 << 6, </span><span class="cx"> FONTFLAG_STRIKETHROUGH = 1 << 7, </span><del>- }; - </del><span class="cx"> </span><span class="cx"> The known font encodings are: </span><span class="cx"> </span><del>- - enum FontEncoding - { </del><span class="cx"> FONTENCODING_SYSTEM = -1, // system default </span><span class="cx"> FONTENCODING_DEFAULT, // current default encoding </span><span class="cx"> </span><span class="lines">@@ -131,23 +114,16 @@ </span><span class="cx"> // EncodingConverter class </span><span class="cx"> </span><span class="cx"> FONTENCODING_MAX </span><del>- }; - </del><span class="cx"> </span><del>-h2. Predefined objects </del><ins>+h2. Predefined constants objects </ins><span class="cx"> </span><del>-Objects: </del><ins>+* @Wx::NORMAL_FONT@ *NullFont* +* @Wx::SMALL_FONT@ +* @Wx::ITALIC_FONT@ +* @Wx::SWISS_FONT@ </ins><span class="cx"> </span><del>-*NullFont* </del><span class="cx"> </span><del>-Pointers: </del><span class="cx"> </span><del>-*NORMAL_FONT - -SMALL_FONT\\ -ITALIC_FONT\\ -SWISS_FONT* - </del><span class="cx"> h2. See also </span><span class="cx"> </span><span class="cx"> "Font overview":fontoverview.html, "DC#set_font":dc.html#DC_setfont, "DC#draw_text":dc.html#DC_drawtext, "DC#get_text_extent":dc.html#DC_gettextextent, "FontDialog":fontdialog.html, "SystemSettings":systemsettings.html </span><span class="lines">@@ -156,9 +132,17 @@ </span><span class="cx"> </span><span class="cx"> h2. Methods </span><span class="cx"> </span><ins>+h3. Class Methods + +* "Font#get_default_encoding":#Font_getdefaultencoding +* "Font#get_default_encoding_name":#Font_getdefaultencodingname </ins><span class="cx"> * "Font.new":#Font_new </span><ins>+ +h3. Instance Methods + + </ins><span class="cx"> * "Font#is_fixed_width":#Font_isfixedwidth </span><del>-* "Font#get_default_encoding":#Font_getdefaultencoding </del><ins>+ </ins><span class="cx"> * "Font#get_face_name":#Font_getfacename </span><span class="cx"> * "Font#get_family":#Font_getfamily </span><span class="cx"> * "Font#get_native_font_info_desc":#Font_getnativefontinfodesc </span><span class="lines">@@ -179,8 +163,32 @@ </span><span class="cx"> </span><span class="cx"> </div> </span><span class="cx"> </span><ins>+h2. Class Methods </ins><span class="cx"> </span><span class="cx"> </span><ins>+h3(#Font_getdefaultencoding). Font.get_default_encoding + + Integer *get_default_encoding*() + +Returns an integer constant identifying the current application''s +default encoding. This is set by the OS, and may be changed by using +"set_default_encoding":#Font_setdefaultencoding + +h4. See also + +"get_default_encoding_name":#Font_getdefaultencodingname + +h3(#Font_getdefaultencodingname). Font.get_default_encoding_name + + String *get_default_encoding_name*() + +Returns the name of the current application''s default encoding. This is +returned as a string suitable for use with Ruby''s ''iconv'' library. + +h4. See also + +"Font encoding overview":fontencodingoverview.html, + </ins><span class="cx"> h3(#Font_new). Font.new </span><span class="cx"> </span><span class="cx"> *Font.new*(%(arg-type)Integer% pointSize, %(arg-type)FontFamily% family, </span><span class="lines">@@ -250,41 +258,39 @@ </span><span class="cx"> See also "DC#set_font":dc.html#DC_setfont, "DC#draw_text":dc.html#DC_drawtext </span><span class="cx"> and "DC#get_text_extent":dc.html#DC_gettextextent. </span><span class="cx"> </span><ins>+h3(#Font_setdefaultencoding). Font#set_default_encoding </ins><span class="cx"> </span><del>- *destructor*() </del><ins>+ *set_default_encoding*(%(arg-type)FontEncoding% encoding) </ins><span class="cx"> </span><del>-Destructor. </del><ins>+Sets the default font encoding, passing a valid @Wx::FONTENCODING_XX@ constant. </ins><span class="cx"> </span><del>-h4. Remarks </del><ins>+h4. See also </ins><span class="cx"> </span><del>-The destructor may not delete the underlying font object of the native windowing -system, since Font uses a reference counting system for efficiency. </del><ins>+"Font encoding overview":fontencodingoverview.html, +"get_default_encoding":#Font_getdefaultencoding </ins><span class="cx"> </span><del>-Although all remaining fonts are deleted when the application exits, -the application should try to clean up all fonts itself. This is because -Widgets cannot know if a pointer to the font object is stored in an -application data structure, and there is a risk of double deletion. </del><span class="cx"> </span><ins>+h3(#Font_setdefaultencoding). Font#set_default_encoding_name </ins><span class="cx"> </span><del>-h3(#Font_isfixedwidth). Font#is_fixed_width </del><ins>+ *set_default_encoding*(%(arg-type)FontEncoding% encoding) </ins><span class="cx"> </span><del>- Boolean *is_fixed_width*() </del><ins>+Sets the default font encoding, passing an encoding name. </ins><span class="cx"> </span><del>-Returns @true@ if the font is a fixed width (or monospaced) font, -@false@ if it is a proportional one or font is invalid. </del><ins>+h4. See also </ins><span class="cx"> </span><ins>+"Font encoding overview":fontencodingoverview.html, +"get_default_encoding":#Font_getdefaultencoding </ins><span class="cx"> </span><del>-h3(#Font_getdefaultencoding). Font#get_default_encoding </del><span class="cx"> </span><del>- "FontEncoding":fontencoding.html *get_default_encoding*() </del><span class="cx"> </span><del>-Returns the current application''s default encoding. </del><ins>+h2. Instance Methods </ins><span class="cx"> </span><del>-h4. See also </del><ins>+h3(#Font_isfixedwidth). Font#is_fixed_width </ins><span class="cx"> </span><del>-"Font encoding overview":fontencodingoverview.html, -"set_default_encoding":#Font_setdefaultencoding </del><ins>+ Boolean *is_fixed_width*() </ins><span class="cx"> </span><ins>+Returns @true@ if the font is a fixed width (or monospaced) font, +@false@ if it is a proportional one or font is invalid. </ins><span class="cx"> </span><span class="cx"> h3(#Font_getfacename). Font#get_face_name </span><span class="cx"> </span><span class="lines">@@ -408,18 +414,6 @@ </span><span class="cx"> Returns @true@ if this object is a valid font, @false@ otherwise. </span><span class="cx"> </span><span class="cx"> </span><del>-h3(#Font_setdefaultencoding). Font#set_default_encoding - - *set_default_encoding*(%(arg-type)FontEncoding% encoding) - -Sets the default font encoding. - -h4. See also - -"Font encoding overview":fontencodingoverview.html, -"get_default_encoding":#Font_getdefaultencoding - - </del><span class="cx"> h3(#Font_setfacename). Font#set_face_name </span><span class="cx"> </span><span class="cx"> *set_face_name*(%(arg-type)String% faceName) </span></span></pre></div> <a id="trunkwxruby2doctextileinternationalizationtxtl"></a> <div class="addfile"><h4>Added: trunk/wxruby2/doc/textile/internationalization.txtl (0 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/doc/textile/internationalization.txtl         (rev 0) +++ trunk/wxruby2/doc/textile/internationalization.txtl        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -0,0 +1,275 @@ </span><ins>+h1. Internationalisation + +wxRuby includes support for writing multilingual applications. If you +write applications using only English ASCII characters, it should be +transparent. However, if you wish to display or work with accented +letters, or characters from other writing systems, this page provides a +brief explanation of how this is handled in wxRuby. + +h2. Font encoding + +wxRuby uses UTF-8 internally for all strings. Any string passed into +wxRuby for use in the interface (for example, as a window title or in +TextCtrl content) should be in UTF-8 format. This has several +implications. If the string is a literal within Ruby code, and the +string contains non-ASCII characters, you should ensure that your Ruby +code is declared to be in UTF-8: + + # Place at start of program to tell ruby this script is written in + # UTF-8 encoded text. + $KCODE = ''u'' + +If the string is being read from a file or other source, and may contain +non-ASCII characters you should ensure that it is in UTF-8 format before +passing it into wxRuby; Ruby''s standard ''iconv'' library may be used +for this purpose. + +The default encoding for the user''s OS can be discovered by using +the @get_default_encoding_name@ method supplied by the +"Locale":locale.html class. + + +h2. Supported Languages + +The following Ruby constants define supported languages in wxRuby. The +user''s default language can be discovered by using the +@get_default_language@ method from the "Locale":locale.html class. + + # user''s default language as obtained from the operating system + Wx::LANGUAGE_DEFAULT          + + # Unknown language, returned if language detection fails + Wx::LANGUAGE_UNKNOWN          + + # user defined languages'' integer identifiers should start from here + Wx::LANGUAGE_USER_DEFINED + + # Known languages + Wx::LANGUAGE_ABKHAZIAN          + Wx::LANGUAGE_AFAR          + Wx::LANGUAGE_AFRIKAANS          + Wx::LANGUAGE_ALBANIAN          + Wx::LANGUAGE_AMHARIC          + Wx::LANGUAGE_ARABIC          + Wx::LANGUAGE_ARABIC_ALGERIA          + Wx::LANGUAGE_ARABIC_BAHRAIN          + Wx::LANGUAGE_ARABIC_EGYPT          + Wx::LANGUAGE_ARABIC_IRAQ          + Wx::LANGUAGE_ARABIC_JORDAN          + Wx::LANGUAGE_ARABIC_KUWAIT          + Wx::LANGUAGE_ARABIC_LEBANON          + Wx::LANGUAGE_ARABIC_LIBYA          + Wx::LANGUAGE_ARABIC_MOROCCO          + Wx::LANGUAGE_ARABIC_OMAN          + Wx::LANGUAGE_ARABIC_QATAR          + Wx::LANGUAGE_ARABIC_SAUDI_ARABIA          + Wx::LANGUAGE_ARABIC_SUDAN          + Wx::LANGUAGE_ARABIC_SYRIA          + Wx::LANGUAGE_ARABIC_TUNISIA          + Wx::LANGUAGE_ARABIC_UAE          + Wx::LANGUAGE_ARABIC_YEMEN          + Wx::LANGUAGE_ARMENIAN          + Wx::LANGUAGE_ASSAMESE          + Wx::LANGUAGE_AYMARA          + Wx::LANGUAGE_AZERI          + Wx::LANGUAGE_AZERI_CYRILLIC          + Wx::LANGUAGE_AZERI_LATIN          + Wx::LANGUAGE_BASHKIR          + Wx::LANGUAGE_BASQUE          + Wx::LANGUAGE_BELARUSIAN          + Wx::LANGUAGE_BENGALI          + Wx::LANGUAGE_BHUTANI          + Wx::LANGUAGE_BIHARI          + Wx::LANGUAGE_BISLAMA          + Wx::LANGUAGE_BRETON          + Wx::LANGUAGE_BULGARIAN          + Wx::LANGUAGE_BURMESE          + Wx::LANGUAGE_CAMBODIAN          + Wx::LANGUAGE_CATALAN          + Wx::LANGUAGE_CHINESE          + Wx::LANGUAGE_CHINESE_SIMPLIFIED          + Wx::LANGUAGE_CHINESE_TRADITIONAL          + Wx::LANGUAGE_CHINESE_HONGKONG          + Wx::LANGUAGE_CHINESE_MACAU          + Wx::LANGUAGE_CHINESE_SINGAPORE          + Wx::LANGUAGE_CHINESE_TAIWAN          + Wx::LANGUAGE_CORSICAN          + Wx::LANGUAGE_CROATIAN          + Wx::LANGUAGE_CZECH          + Wx::LANGUAGE_DANISH          + Wx::LANGUAGE_DUTCH          + Wx::LANGUAGE_DUTCH_BELGIAN          + Wx::LANGUAGE_ENGLISH          + Wx::LANGUAGE_ENGLISH_UK          + Wx::LANGUAGE_ENGLISH_US          + Wx::LANGUAGE_ENGLISH_AUSTRALIA          + Wx::LANGUAGE_ENGLISH_BELIZE          + Wx::LANGUAGE_ENGLISH_BOTSWANA          + Wx::LANGUAGE_ENGLISH_CANADA          + Wx::LANGUAGE_ENGLISH_CARIBBEAN          + Wx::LANGUAGE_ENGLISH_DENMARK          + Wx::LANGUAGE_ENGLISH_EIRE          + Wx::LANGUAGE_ENGLISH_JAMAICA          + Wx::LANGUAGE_ENGLISH_NEW_ZEALAND          + Wx::LANGUAGE_ENGLISH_PHILIPPINES          + Wx::LANGUAGE_ENGLISH_SOUTH_AFRICA          + Wx::LANGUAGE_ENGLISH_TRINIDAD          + Wx::LANGUAGE_ENGLISH_ZIMBABWE          + Wx::LANGUAGE_ESPERANTO          + Wx::LANGUAGE_ESTONIAN          + Wx::LANGUAGE_FAEROESE          + Wx::LANGUAGE_FARSI          + Wx::LANGUAGE_FIJI          + Wx::LANGUAGE_FINNISH          + Wx::LANGUAGE_FRENCH          + Wx::LANGUAGE_FRENCH_BELGIAN          + Wx::LANGUAGE_FRENCH_CANADIAN          + Wx::LANGUAGE_FRENCH_LUXEMBOURG          + Wx::LANGUAGE_FRENCH_MONACO          + Wx::LANGUAGE_FRENCH_SWISS          + Wx::LANGUAGE_FRISIAN          + Wx::LANGUAGE_GALICIAN          + Wx::LANGUAGE_GEORGIAN          + Wx::LANGUAGE_GERMAN          + Wx::LANGUAGE_GERMAN_AUSTRIAN          + Wx::LANGUAGE_GERMAN_BELGIUM          + Wx::LANGUAGE_GERMAN_LIECHTENSTEIN          + Wx::LANGUAGE_GERMAN_LUXEMBOURG          + Wx::LANGUAGE_GERMAN_SWISS          + Wx::LANGUAGE_GREEK          + Wx::LANGUAGE_GREENLANDIC          + Wx::LANGUAGE_GUARANI          + Wx::LANGUAGE_GUJARATI          + Wx::LANGUAGE_HAUSA          + Wx::LANGUAGE_HEBREW          + Wx::LANGUAGE_HINDI          + Wx::LANGUAGE_HUNGARIAN          + Wx::LANGUAGE_ICELANDIC          + Wx::LANGUAGE_INDONESIAN          + Wx::LANGUAGE_INTERLINGUA          + Wx::LANGUAGE_INTERLINGUE          + Wx::LANGUAGE_INUKTITUT          + Wx::LANGUAGE_INUPIAK          + Wx::LANGUAGE_IRISH          + Wx::LANGUAGE_ITALIAN          + Wx::LANGUAGE_ITALIAN_SWISS          + Wx::LANGUAGE_JAPANESE          + Wx::LANGUAGE_JAVANESE          + Wx::LANGUAGE_KANNADA          + Wx::LANGUAGE_KASHMIRI          + Wx::LANGUAGE_KASHMIRI_INDIA          + Wx::LANGUAGE_KAZAKH          + Wx::LANGUAGE_KERNEWEK          + Wx::LANGUAGE_KINYARWANDA          + Wx::LANGUAGE_KIRGHIZ          + Wx::LANGUAGE_KIRUNDI          + Wx::LANGUAGE_KONKANI          + Wx::LANGUAGE_KOREAN          + Wx::LANGUAGE_KURDISH          + Wx::LANGUAGE_LAOTHIAN          + Wx::LANGUAGE_LATIN          + Wx::LANGUAGE_LATVIAN          + Wx::LANGUAGE_LINGALA          + Wx::LANGUAGE_LITHUANIAN          + Wx::LANGUAGE_MACEDONIAN          + Wx::LANGUAGE_MALAGASY          + Wx::LANGUAGE_MALAY          + Wx::LANGUAGE_MALAYALAM          + Wx::LANGUAGE_MALAY_BRUNEI_DARUSSALAM          + Wx::LANGUAGE_MALAY_MALAYSIA          + Wx::LANGUAGE_MALTESE          + Wx::LANGUAGE_MANIPURI          + Wx::LANGUAGE_MAORI          + Wx::LANGUAGE_MARATHI          + Wx::LANGUAGE_MOLDAVIAN          + Wx::LANGUAGE_MONGOLIAN          + Wx::LANGUAGE_NAURU          + Wx::LANGUAGE_NEPALI          + Wx::LANGUAGE_NEPALI_INDIA          + Wx::LANGUAGE_NORWEGIAN_BOKMAL          + Wx::LANGUAGE_NORWEGIAN_NYNORSK          + Wx::LANGUAGE_OCCITAN          + Wx::LANGUAGE_ORIYA          + Wx::LANGUAGE_OROMO          + Wx::LANGUAGE_PASHTO          + Wx::LANGUAGE_POLISH          + Wx::LANGUAGE_PORTUGUESE          + Wx::LANGUAGE_PORTUGUESE_BRAZILIAN          + Wx::LANGUAGE_PUNJABI          + Wx::LANGUAGE_QUECHUA          + Wx::LANGUAGE_RHAETO_ROMANCE          + Wx::LANGUAGE_ROMANIAN          + Wx::LANGUAGE_RUSSIAN          + Wx::LANGUAGE_RUSSIAN_UKRAINE          + Wx::LANGUAGE_SAMOAN          + Wx::LANGUAGE_SANGHO          + Wx::LANGUAGE_SANSKRIT          + Wx::LANGUAGE_SCOTS_GAELIC          + Wx::LANGUAGE_SERBIAN          + Wx::LANGUAGE_SERBIAN_CYRILLIC          + Wx::LANGUAGE_SERBIAN_LATIN          + Wx::LANGUAGE_SERBO_CROATIAN          + Wx::LANGUAGE_SESOTHO          + Wx::LANGUAGE_SETSWANA          + Wx::LANGUAGE_SHONA          + Wx::LANGUAGE_SINDHI          + Wx::LANGUAGE_SINHALESE          + Wx::LANGUAGE_SISWATI          + Wx::LANGUAGE_SLOVAK          + Wx::LANGUAGE_SLOVENIAN          + Wx::LANGUAGE_SOMALI          + Wx::LANGUAGE_SPANISH          + Wx::LANGUAGE_SPANISH_ARGENTINA          + Wx::LANGUAGE_SPANISH_BOLIVIA          + Wx::LANGUAGE_SPANISH_CHILE          + Wx::LANGUAGE_SPANISH_COLOMBIA          + Wx::LANGUAGE_SPANISH_COSTA_RICA          + Wx::LANGUAGE_SPANISH_DOMINICAN_REPUBLIC          + Wx::LANGUAGE_SPANISH_ECUADOR          + Wx::LANGUAGE_SPANISH_EL_SALVADOR          + Wx::LANGUAGE_SPANISH_GUATEMALA          + Wx::LANGUAGE_SPANISH_HONDURAS          + Wx::LANGUAGE_SPANISH_MEXICAN          + Wx::LANGUAGE_SPANISH_MODERN          + Wx::LANGUAGE_SPANISH_NICARAGUA          + Wx::LANGUAGE_SPANISH_PANAMA          + Wx::LANGUAGE_SPANISH_PARAGUAY          + Wx::LANGUAGE_SPANISH_PERU          + Wx::LANGUAGE_SPANISH_PUERTO_RICO          + Wx::LANGUAGE_SPANISH_URUGUAY          + Wx::LANGUAGE_SPANISH_US          + Wx::LANGUAGE_SPANISH_VENEZUELA          + Wx::LANGUAGE_SUNDANESE          + Wx::LANGUAGE_SWAHILI          + Wx::LANGUAGE_SWEDISH          + Wx::LANGUAGE_SWEDISH_FINLAND          + Wx::LANGUAGE_TAGALOG          + Wx::LANGUAGE_TAJIK          + Wx::LANGUAGE_TAMIL          + Wx::LANGUAGE_TATAR          + Wx::LANGUAGE_TELUGU          + Wx::LANGUAGE_THAI          + Wx::LANGUAGE_TIBETAN          + Wx::LANGUAGE_TIGRINYA          + Wx::LANGUAGE_TONGA          + Wx::LANGUAGE_TSONGA          + Wx::LANGUAGE_TURKISH          + Wx::LANGUAGE_TURKMEN          + Wx::LANGUAGE_TWI          + Wx::LANGUAGE_UIGHUR          + Wx::LANGUAGE_UKRAINIAN          + Wx::LANGUAGE_URDU          + Wx::LANGUAGE_URDU_INDIA          + Wx::LANGUAGE_URDU_PAKISTAN          + Wx::LANGUAGE_UZBEK          + Wx::LANGUAGE_UZBEK_CYRILLIC          + Wx::LANGUAGE_UZBEK_LATIN          + Wx::LANGUAGE_VIETNAMESE          + Wx::LANGUAGE_VOLAPUK          + Wx::LANGUAGE_WELSH          + Wx::LANGUAGE_WOLOF          + Wx::LANGUAGE_XHOSA          + Wx::LANGUAGE_YIDDISH          + Wx::LANGUAGE_YORUBA          + Wx::LANGUAGE_ZHUANG          + Wx::LANGUAGE_ZULU </ins></span></pre></div> <a id="trunkwxruby2doctextilelocaletxtl"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/doc/textile/locale.txtl (757 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/doc/textile/locale.txtl        2006-11-24 17:17:52 UTC (rev 757) +++ trunk/wxruby2/doc/textile/locale.txtl        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -1,16 +1,17 @@ </span><span class="cx"> h1(#wxlocale). Wx::Locale </span><span class="cx"> </span><del>-Locale class encapsulates all language-dependent settings and is a -generalization of the C locale concept. </del><ins>+The Locale class encapsulates all language-dependent settings and is a +generalization of the C locale concept. This class''s methods may be used +to discover information about the user''s default language, such as its +canonical name, description and character encoding. It may also be used +to set an alternative locale, via @Wx::Locale.set_locale@. This will +affect things like the default date format. </ins><span class="cx"> </span><del>-In Widgets this class manages message catalogs which contain the translations -of the strings used to the current language. </del><ins>+In WxWidgets this class also manages message catalogs which contain +translations of the strings used for the current language. However, the +methods for getting translations of strings (@get_string@, @add_catalog@ +etc) are not currently supported in wxRuby. </ins><span class="cx"> </span><del>- -h2. Derived from - -No base class - </del><span class="cx"> h2. See also </span><span class="cx"> </span><span class="cx"> "Internationalization overview":internationalization.html, </span><span class="lines">@@ -21,24 +22,29 @@ </span><span class="cx"> </span><span class="cx"> h2. Methods </span><span class="cx"> </span><del>-* "Supported languages":#Locale_languages </del><ins>+h3. Class Methods + +* "Locale#find_language_info":#Locale_findlanguageinfo +* "Locale#get_language_info":#Locale_getlanguageinfo +* "Locale#get_language_name":#Locale_getlanguagename +* "Locale.get_system_encoding":#Locale_getsystemencoding +* "Locale.get_system_encoding_name":#Locale_getsystemencodingname +* "Locale.get_system_language":#Locale_getsystemlanguage </ins><span class="cx"> * "Locale.new":#Locale_new </span><ins>+ +h3. Instance Methods + +* "Supported languages":#Locale_languages </ins><span class="cx"> * "Locale#add_catalog":#Locale_addcatalog </span><del>-* "Locale#add_catalog_lookup_path_prefix":#Locale_addcataloglookuppathprefix </del><ins>+* "Locale#add_catalog_lookup_path_prefix":Locale_addcataloglookuppathprefix </ins><span class="cx"> * "Locale#add_language":#Locale_addlanguage </span><del>-* "Locale#find_language_info":#Locale_findlanguageinfo </del><span class="cx"> * "Locale#get_canonical_name":#Locale_getcanonicalname </span><span class="cx"> * "Locale#get_language":#Locale_getlanguage </span><del>-* "Locale#get_language_info":#Locale_getlanguageinfo -* "Locale#get_language_name":#Locale_getlanguagename </del><span class="cx"> * "Locale#get_locale":#Locale_getlocale </span><span class="cx"> * "Locale#get_name":#Locale_getname </span><span class="cx"> * "Locale#get_string":#Locale_getstring </span><span class="cx"> * "Locale#get_header_value":#Locale_getheadervalue </span><span class="cx"> * "Locale#get_sys_name":#Locale_getsysname </span><del>-* "Locale#get_system_encoding":#Locale_getsystemencoding -* "Locale#get_system_encoding_name":#Locale_getsystemencodingname -* "Locale#get_system_language":#Locale_getsystemlanguage </del><span class="cx"> * "Locale#init":#Locale_init </span><span class="cx"> * "Locale#is_loaded":#Locale_isloaded </span><span class="cx"> * "Locale#is_ok":#Locale_isok </span><span class="lines">@@ -46,46 +52,90 @@ </span><span class="cx"> </div> </span><span class="cx"> </span><span class="cx"> </span><ins>+h2. Class Methods </ins><span class="cx"> </span><ins>+h3(#Locale_findlanguageinfo). Locale.find_language_info </ins><span class="cx"> </span><del>-h3(#wxlanguage). Supported languages </del><ins>+ "LanguageInfo":languageinfo.html *find_language_info*(%(arg-type)String% locale) </ins><span class="cx"> </span><del>-See "list of recognized language constants":languagecodes.html. -These constants may be used to specify the language -in "Init":localeinit.html and are returned by -"get_system_language":#Locale_getsystemlanguage: </del><ins>+This function may be used to find the language description structure for the +given locale, specified either as a two letter ISO language code (for example, +"pt"), a language code followed by the country code ("pt_BR") or a full, human +readable, language description ("Portuguese-Brazil"). </ins><span class="cx"> </span><ins>+Returns the information for the given language or @nil@ if this language +is unknown. </ins><span class="cx"> </span><ins>+h4. See also + +"get_language_info":#Locale_getlanguageinfo + +h3(#Locale_getlanguageinfo). Locale.get_language_info + + "LanguageInfo":languageinfo.html *get_language_info*(%(arg-type)Integer% lang) + +Returns a pointer to LanguageInfo structure containing information about the +given language or @NULL@ if this language is unknown. Note that even if the +returned pointer is valid, the caller should _not_ delete it. + +See "add_language":#Locale_addlanguage for the LanguageInfo +description. + +As with "Init":localeinit.html, @LANGUAGE_DEFAULT@ has the +special meaning if passed as an argument to this function and in this case the +result of "get_system_language()":#Locale_getsystemlanguage() is used. + +h3(#Locale_getsystemencodingname). Locale.get_system_encoding_name + + String *get_system_encoding_name*() + +Returns the name of the user''s default font encoding, for example +''ISO-8859-1''. Nil is returned if the system encoding couldn''t be +detected. + +h3(#Locale_getsystemlanguage). Locale.get_system_language + + Integer *get_system_language*() + +Tries to detect the user''s default language setting. Returns +"Language":language.html, for example @Wx::LANGUAGE_ENGLISH_UK@ value or +1 (@Wx::LANGUAGE_UNKNOWN@) if the language-guessing algorithm failed. + +h3(#Locale_getsystemlanguage). Locale.get_system_language_name + + String *get_system_language_name*() + +Returns the name of the user''s default langage. Returns an uppercase +String name, for example "ENGLISH_UK". + </ins><span class="cx"> h3(#Locale_defnew). Locale.new </span><span class="cx"> </span><span class="cx"> *Locale.new*(%(arg-type)Integer% language, </span><del>- %(arg-type)Integer% flags = LOCALE_LOAD_DEFAULT | LOCALE_CONV_ENCODING) </del><ins>+ %(arg-type)Integer% flags = LOCALE_LOAD_DEFAULT|LOCALE_CONV_ENCODING) </ins><span class="cx"> </span><del>-See "Init()":localeinit.html for parameters description. </del><ins>+Creates a new Wx::Locale object, *and* sets it to be the global locale +used by this location. As an important side-effect, calling this method +sets the application locale to the language; see +"Locale.set_locale":#setlocale. </ins><span class="cx"> </span><del>- *Locale.new*(%(arg-type)char% szName, %(arg-type)char% szShort = nil, - %(arg-type)char% szLocale = nil, - %(arg-type)Boolean% bLoadDefault = true, - %(arg-type)Boolean% bConvertEncoding = false) </del><ins>+h3(#Locale_setlocale). Locale.set_locale </ins><span class="cx"> </span><del>-See "Init()":localeinit.html for parameters description. </del><ins>+ *Locale.new*(%(arg-type)Integer% language) </ins><span class="cx"> </span><del>-The call of this function has several global side effects which you should -understand: first of all, the application locale is changed - note that this -will affect many of standard C library functions such as printf() or strftime(). -Second, this Locale object becomes the new current global locale for the -application and so all subsequent calls to GetTranslation() will try to -translate the messages using the message catalogs for this locale. </del><ins>+ *Locale.new*(%(arg-type)String% language) </ins><span class="cx"> </span><span class="cx"> </span><ins>+Sets @language@ to be the default language for this +application. @language@ may be a @Wx::LANGUAGE_XXX@ constant (for example, +@Wx::LANGUAGE_DUTCH@) or a canonical name (for example, ''pt_BR'', for +Brazilian Portuguese). </ins><span class="cx"> </span><del>- *destructor*() </del><ins>+The call of this function has several global effects which you +should understand: first of all, the application locale is changed - +note that this will affect standard ruby methods such as Time#strftime. </ins><span class="cx"> </span><del>-The destructor, like the constructor, also has global side effects: the previously -set locale is restored and so the changes described in -"Init":localeinit.html documentation are rolled back. </del><ins>+h2. Instance Methods </ins><span class="cx"> </span><del>- </del><span class="cx"> h3(#Locale_addcatalog). Locale#add_catalog </span><span class="cx"> </span><span class="cx"> Boolean *add_catalog*(%(arg-type)char% szDomain) </span><span class="lines">@@ -146,45 +196,14 @@ </span><span class="cx"> database is used in conjunction with the first form of </span><span class="cx"> "Init":localeinit.html. </span><span class="cx"> </span><del>-LanguageInfo is defined as follows: </del><ins>+LanguageInfo is a Ruby struct class with the following accessors: </ins><span class="cx"> </span><ins>+* language (Integer language identifier id) +* canonical_name (Canonical name, eg fr_FR) +* description (Human readable string name of the language) </ins><span class="cx"> </span><del>- struct WXDLLEXPORT LanguageInfo - { - int Language; // Language id - String CanonicalName; // Canonical name, e.g. fr_FR - #ifdef __WIN32__ - Uint32 WinLang, WinSublang; // Win32 language identifiers - // (LANG_xxxx, SUBLANG_xxxx) - #endif - String Description; // human-readable name of the language - }; - </del><ins>+The value of _Language_ should be greater than @Wx::LANGUAGE_USER_DEFINED@. </ins><span class="cx"> </span><del>- -_Language_ should be greater than LANGUAGE_USER_DEFINED. - - - - -h3(#Locale_findlanguageinfo). Locale#find_language_info - - "LanguageInfo":languageinfo.html *find_language_info*(%(arg-type)String% locale) - -This function may be used to find the language description structure for the -given locale, specified either as a two letter ISO language code (for example, -"pt"), a language code followed by the country code ("pt_BR") or a full, human -readable, language description ("Portuguese-Brazil"). - -Returns the information for the given language or @NULL@ if this language -is unknown. Note that even if the returned pointer is valid, the caller should -_not_ delete it. - -h4. See also - -"get_language_info":#Locale_getlanguageinfo - - </del><span class="cx"> h3(#Locale_getcanonicalname). Locale#get_canonical_name </span><span class="cx"> </span><span class="cx"> String *get_canonical_name*() </span><span class="lines">@@ -198,9 +217,6 @@ </span><span class="cx"> </span><span class="cx"> Compare "get_sys_name":#Locale_getsysname. </span><span class="cx"> </span><del>- - - </del><span class="cx"> h3(#Locale_getlanguage). Locale#get_language </span><span class="cx"> </span><span class="cx"> Integer *get_language*() </span><span class="lines">@@ -210,22 +226,6 @@ </span><span class="cx"> "Init":localeinit.html that takes Language argument. </span><span class="cx"> </span><span class="cx"> </span><del>-h3(#Locale_getlanguageinfo). Locale#get_language_info - - "LanguageInfo":languageinfo.html *get_language_info*(%(arg-type)Integer% lang) - -Returns a pointer to LanguageInfo structure containing information about the -given language or @NULL@ if this language is unknown. Note that even if the -returned pointer is valid, the caller should _not_ delete it. - -See "add_language":#Locale_addlanguage for the LanguageInfo -description. - -As with "Init":localeinit.html, @LANGUAGE_DEFAULT@ has the -special meaning if passed as an argument to this function and in this case the -result of "get_system_language()":#Locale_getsystemlanguage() is used. - - </del><span class="cx"> h3(#Locale_getlanguagename). Locale#get_language_name </span><span class="cx"> </span><span class="cx"> String *get_language_name*(%(arg-type)Integer% lang) </span><span class="lines">@@ -239,20 +239,17 @@ </span><span class="cx"> </span><span class="cx"> h3(#Locale_getlocale). Locale#get_locale </span><span class="cx"> </span><del>- char *get_locale*() </del><ins>+ String *get_locale*() </ins><span class="cx"> </span><del>-Returns the locale name as passed to the constructor or -"Init()":localeinit.html. This is full, human-readable name, -e.g. "English" or "French". </del><ins>+Returns the locale name as passed to the constructor. This is full, +human-readable name, e.g. "English" or "French". </ins><span class="cx"> </span><span class="cx"> </span><del>- </del><span class="cx"> h3(#Locale_getname). Locale#get_name </span><span class="cx"> </span><span class="cx"> String *get_name*() </span><span class="cx"> </span><del>-Returns the current short name for the locale (as given to the constructor or -the Init() function). </del><ins>+Returns the current short name for the locale. </ins><span class="cx"> </span><span class="cx"> </span><span class="cx"> h3(#Locale_getstring). Locale#get_string </span><span class="lines">@@ -263,12 +260,13 @@ </span><span class="cx"> %(arg-type)size_t% n, </span><span class="cx"> %(arg-type)char% szDomain = nil) </span><span class="cx"> </span><del>-Retrieves the translation for a string in all loaded domains unless the szDomain -parameter is specified (and then only this catalog/domain is searched). </del><ins>+Retrieves the translation for a string in all loaded domains unless the +szDomain parameter is specified (and then only this catalog/domain is +searched). </ins><span class="cx"> </span><del>-Returns original string if translation is not available -(in this case an error message is generated the first time -a string is not found; use "LogNull":logoverview.html to suppress it). </del><ins>+Returns original string if translation is not available (in this case an +error message is generated the first time a string is not found; use +"LogNull":logoverview.html to suppress it). </ins><span class="cx"> </span><span class="cx"> The second form is used when retrieving translation of string that has </span><span class="cx"> different singular and plural form in English or different plural forms in some </span><span class="lines">@@ -307,7 +305,6 @@ </span><span class="cx"> Compare "get_canonical_name":#Locale_getcanonicalname. </span><span class="cx"> </span><span class="cx"> </span><del>- </del><span class="cx"> h3(#Locale_getsystemencoding). Locale#get_system_encoding </span><span class="cx"> </span><span class="cx"> "FontEncoding":fontencoding.html *get_system_encoding*() </span><span class="lines">@@ -317,29 +314,7 @@ </span><span class="cx"> *FONTENCODING_SYSTEM* if it couldn''t be determined. </span><span class="cx"> </span><span class="cx"> </span><del>-h3(#Locale_getsystemencodingname). Locale#get_system_encoding_name </del><span class="cx"> </span><del>- String *get_system_encoding_name*() - -Tries to detect the name of the user''s default font encoding. This string isn''t -particularly useful for the application as its form is platform-dependent and -so you should probably use -"get_system_encoding":#Locale_getsystemencoding instead. - -Returns a user-readable string value or an empty string if it couldn''t be -determined. - - -h3(#Locale_getsystemlanguage). Locale#get_system_language - - Integer *get_system_language*() - -Tries to detect the user''s default language setting. -Returns "Language":language.html value or - *LANGUAGE_UNKNOWN* if the language-guessing algorithm failed. - - - </del><span class="cx"> h3(#Locale_init). Locale#init </span><span class="cx"> </span><span class="cx"> </span></span></pre></div> <a id="trunkwxruby2libwxclassesfontrb"></a> <div class="addfile"><h4>Added: trunk/wxruby2/lib/wx/classes/font.rb (0 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/lib/wx/classes/font.rb         (rev 0) +++ trunk/wxruby2/lib/wx/classes/font.rb        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -0,0 +1,118 @@ </span><ins>+class Wx::Font + # String names of the constants provided by C++ + # (enum is originally defined inc include/wx/fontenc.h) + ENCODING_NAMES = %w[ + DEFAULT + + ISO-8859-1 + ISO-8859-2 + ISO-8859-3 + ISO-8859-4 + ISO-8859-5 + ISO-8859-6 + ISO-8859-7 + ISO-8859-8 + ISO-8859-9 + ISO-8859-10 + ISO-8859-11 + ISO-8859-12 + ISO-8859-13 + ISO-8859-14 + ISO-8859-15 + ISO-8859-MAX + + KOI8 + KOI8-U + ALTERNATIVE + BULGARIAN + + CP437 + CP850 + CP852 + CP855 + CP866 + + CP874 + CP932 + CP936 + CP949 + CP950 + CP1250 + CP1251 + CP1252 + CP1253 + CP1254 + CP1255 + CP1256 + CP1257 + CP12-MAX + + UTF7 + UTF8 + EUC-JP + UTF16BE + UTF16LE + UTF32BE + UTF32LE + + MACROMAN + MACJAPANESE + MACCHINESETRAD + MACKOREAN + MACARABIC + MACHEBREW + MACGREEK + MACCYRILLIC + MACDEVANAGARI + MACGURMUKHI + MACGUJARATI + MACORIYA + MACBENGALI + MACTAMIL + MACTELUGU + MACKANNADA + MACMALAJALAM + MACSINHALESE + MACBURMESE + MACKHMER + MACTHAI + MACLAOTIAN + MACGEORGIAN + MACARMENIAN + MACCHINESESIMP + MACTIBETAN + MACMONGOLIAN + MACETHIOPIC + MACCENTRALEUR + MACVIATNAMESE + MACARABICEXT + MACSYMBOL + MACDINGBATS + MACTURKISH + MACCROATIAN + MACICELANDIC + MACROMANIAN + MACCELTIC + MACGAELIC + MACKEYBOARD + MAX + ] + + class << self + # Returns the name of the platform''s default font encoding + def get_default_encoding_name + ENCODING_NAMES[ get_default_encoding ] + end + + # Sets the default encoding to be +enc+, which may be the string + # name of an encoding (eg ''UTF8'') or an internal WxWidgets flag + # (eg Wx::FONTENCODING_UTF8). + def set_default_encoding_name(enc) + if flag_int = ENCODING_NAMES.index(enc.upcase) + set_default_encoding(flag_int) + else + raise ArgumentError, "Unknown font encoding name ''#{enc}''" + end + end + end +end </ins></span></pre></div> <a id="trunkwxruby2libwxclasseslocalerb"></a> <div class="addfile"><h4>Added: trunk/wxruby2/lib/wx/classes/locale.rb (0 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/lib/wx/classes/locale.rb         (rev 0) +++ trunk/wxruby2/lib/wx/classes/locale.rb        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -0,0 +1,28 @@ </span><ins>+class Wx::Locale + class << self + def get_system_language_name + get_language_name( get_system_language ) + end + + def get_system_encoding_name + Wx::Font::ENCODING_NAMES[ get_system_encoding ] + end + + # Set the current locale by a name, canonical name, or Wx::LANGUAGE_ + # constant; mainly here because it seems a bit strange in Ruby to + # have global side-effects in a constructor + def set_locale(locale) + if locale.kind_of?(Fixnum) + new(locale) + elsif locale.kind_of?(String) and lang_info = find_language_info(locale) + new(lang_info.language) + else + raise ArgumentError, "Unknown language #{locale}" + end + end + end + + def get_language_name + self.class.get_language_name(get_language) + end +end </ins></span></pre></div> <a id="trunkwxruby2samplestextunicoderb"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/samples/text/unicode.rb (757 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/samples/text/unicode.rb        2006-11-24 17:17:52 UTC (rev 757) +++ trunk/wxruby2/samples/text/unicode.rb        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -66,6 +66,14 @@ </span><span class="cx"> panel = Wx::Panel.new(self) </span><span class="cx"> sizer = Wx::BoxSizer.new(Wx::VERTICAL) </span><span class="cx"> </span><ins>+ sys_lang = Wx::Locale.get_system_language_name + text = Wx::StaticText.new(panel, -1, "System language: #{sys_lang}") + sizer.add(text, 0, Wx::ALL, 5) + + sys_enc = Wx::Locale.get_system_encoding_name + text = Wx::StaticText.new(panel, -1, "System default encoding: #{sys_enc}") + sizer.add(text, 0, Wx::ALL, 5) + </ins><span class="cx"> # The text input and display </span><span class="cx"> @textctrl = UnicodeDemoTextCtrl.new(panel) </span><span class="cx"> sizer.add(@textctrl, 3, Wx::GROW|Wx::ALL, 2) </span></span></pre></div> <a id="trunkwxruby2swigclassesFonti"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/classes/Font.i (757 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/Font.i        2006-11-24 17:17:52 UTC (rev 757) +++ trunk/wxruby2/swig/classes/Font.i        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -4,9 +4,11 @@ </span><span class="cx"> %include "../common.i" </span><span class="cx"> </span><span class="cx"> %module(directors="1") wxFont </span><del>- </del><span class="cx"> %ignore wxFont::SetNativeFontInfo; </span><span class="cx"> </span><ins>+// import the font encoding constants directly from the WxWidgets source +%include <wx/fontenc.h> + </ins><span class="cx"> %import "include/wxObject.h" </span><span class="cx"> %import "include/wxGDIObject.h" </span><span class="cx"> </span></span></pre></div> <a id="trunkwxruby2swigclassesLocalei"></a> <div class="addfile"><h4>Added: trunk/wxruby2/swig/classes/Locale.i (0 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/Locale.i         (rev 0) +++ trunk/wxruby2/swig/classes/Locale.i        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -0,0 +1,327 @@ </span><ins>+# Copyright 2004-2006 by Kevin Smith +# released under the MIT-style wxruby2 license + +%include "../common.i" + +%module wxLocale + +%{ +#include <wx/intl.h> +%} + + +enum wxLanguage +{ + // user''s default/preffered language as got from OS: + wxLANGUAGE_DEFAULT, + // unknown language, if wxLocale::GetSystemLanguage fails: + wxLANGUAGE_UNKNOWN, + + wxLANGUAGE_ABKHAZIAN, + wxLANGUAGE_AFAR, + wxLANGUAGE_AFRIKAANS, + wxLANGUAGE_ALBANIAN, + wxLANGUAGE_AMHARIC, + wxLANGUAGE_ARABIC, + wxLANGUAGE_ARABIC_ALGERIA, + wxLANGUAGE_ARABIC_BAHRAIN, + wxLANGUAGE_ARABIC_EGYPT, + wxLANGUAGE_ARABIC_IRAQ, + wxLANGUAGE_ARABIC_JORDAN, + wxLANGUAGE_ARABIC_KUWAIT, + wxLANGUAGE_ARABIC_LEBANON, + wxLANGUAGE_ARABIC_LIBYA, + wxLANGUAGE_ARABIC_MOROCCO, + wxLANGUAGE_ARABIC_OMAN, + wxLANGUAGE_ARABIC_QATAR, + wxLANGUAGE_ARABIC_SAUDI_ARABIA, + wxLANGUAGE_ARABIC_SUDAN, + wxLANGUAGE_ARABIC_SYRIA, + wxLANGUAGE_ARABIC_TUNISIA, + wxLANGUAGE_ARABIC_UAE, + wxLANGUAGE_ARABIC_YEMEN, + wxLANGUAGE_ARMENIAN, + wxLANGUAGE_ASSAMESE, + wxLANGUAGE_AYMARA, + wxLANGUAGE_AZERI, + wxLANGUAGE_AZERI_CYRILLIC, + wxLANGUAGE_AZERI_LATIN, + wxLANGUAGE_BASHKIR, + wxLANGUAGE_BASQUE, + wxLANGUAGE_BELARUSIAN, + wxLANGUAGE_BENGALI, + wxLANGUAGE_BHUTANI, + wxLANGUAGE_BIHARI, + wxLANGUAGE_BISLAMA, + wxLANGUAGE_BRETON, + wxLANGUAGE_BULGARIAN, + wxLANGUAGE_BURMESE, + wxLANGUAGE_CAMBODIAN, + wxLANGUAGE_CATALAN, + wxLANGUAGE_CHINESE, + wxLANGUAGE_CHINESE_SIMPLIFIED, + wxLANGUAGE_CHINESE_TRADITIONAL, + wxLANGUAGE_CHINESE_HONGKONG, + wxLANGUAGE_CHINESE_MACAU, + wxLANGUAGE_CHINESE_SINGAPORE, + wxLANGUAGE_CHINESE_TAIWAN, + wxLANGUAGE_CORSICAN, + wxLANGUAGE_CROATIAN, + wxLANGUAGE_CZECH, + wxLANGUAGE_DANISH, + wxLANGUAGE_DUTCH, + wxLANGUAGE_DUTCH_BELGIAN, + wxLANGUAGE_ENGLISH, + wxLANGUAGE_ENGLISH_UK, + wxLANGUAGE_ENGLISH_US, + wxLANGUAGE_ENGLISH_AUSTRALIA, + wxLANGUAGE_ENGLISH_BELIZE, + wxLANGUAGE_ENGLISH_BOTSWANA, + wxLANGUAGE_ENGLISH_CANADA, + wxLANGUAGE_ENGLISH_CARIBBEAN, + wxLANGUAGE_ENGLISH_DENMARK, + wxLANGUAGE_ENGLISH_EIRE, + wxLANGUAGE_ENGLISH_JAMAICA, + wxLANGUAGE_ENGLISH_NEW_ZEALAND, + wxLANGUAGE_ENGLISH_PHILIPPINES, + wxLANGUAGE_ENGLISH_SOUTH_AFRICA, + wxLANGUAGE_ENGLISH_TRINIDAD, + wxLANGUAGE_ENGLISH_ZIMBABWE, + wxLANGUAGE_ESPERANTO, + wxLANGUAGE_ESTONIAN, + wxLANGUAGE_FAEROESE, + wxLANGUAGE_FARSI, + wxLANGUAGE_FIJI, + wxLANGUAGE_FINNISH, + wxLANGUAGE_FRENCH, + wxLANGUAGE_FRENCH_BELGIAN, + wxLANGUAGE_FRENCH_CANADIAN, + wxLANGUAGE_FRENCH_LUXEMBOURG, + wxLANGUAGE_FRENCH_MONACO, + wxLANGUAGE_FRENCH_SWISS, + wxLANGUAGE_FRISIAN, + wxLANGUAGE_GALICIAN, + wxLANGUAGE_GEORGIAN, + wxLANGUAGE_GERMAN, + wxLANGUAGE_GERMAN_AUSTRIAN, + wxLANGUAGE_GERMAN_BELGIUM, + wxLANGUAGE_GERMAN_LIECHTENSTEIN, + wxLANGUAGE_GERMAN_LUXEMBOURG, + wxLANGUAGE_GERMAN_SWISS, + wxLANGUAGE_GREEK, + wxLANGUAGE_GREENLANDIC, + wxLANGUAGE_GUARANI, + wxLANGUAGE_GUJARATI, + wxLANGUAGE_HAUSA, + wxLANGUAGE_HEBREW, + wxLANGUAGE_HINDI, + wxLANGUAGE_HUNGARIAN, + wxLANGUAGE_ICELANDIC, + wxLANGUAGE_INDONESIAN, + wxLANGUAGE_INTERLINGUA, + wxLANGUAGE_INTERLINGUE, + wxLANGUAGE_INUKTITUT, + wxLANGUAGE_INUPIAK, + wxLANGUAGE_IRISH, + wxLANGUAGE_ITALIAN, + wxLANGUAGE_ITALIAN_SWISS, + wxLANGUAGE_JAPANESE, + wxLANGUAGE_JAVANESE, + wxLANGUAGE_KANNADA, + wxLANGUAGE_KASHMIRI, + wxLANGUAGE_KASHMIRI_INDIA, + wxLANGUAGE_KAZAKH, + wxLANGUAGE_KERNEWEK, + wxLANGUAGE_KINYARWANDA, + wxLANGUAGE_KIRGHIZ, + wxLANGUAGE_KIRUNDI, + wxLANGUAGE_KONKANI, + wxLANGUAGE_KOREAN, + wxLANGUAGE_KURDISH, + wxLANGUAGE_LAOTHIAN, + wxLANGUAGE_LATIN, + wxLANGUAGE_LATVIAN, + wxLANGUAGE_LINGALA, + wxLANGUAGE_LITHUANIAN, + wxLANGUAGE_MACEDONIAN, + wxLANGUAGE_MALAGASY, + wxLANGUAGE_MALAY, + wxLANGUAGE_MALAYALAM, + wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, + wxLANGUAGE_MALAY_MALAYSIA, + wxLANGUAGE_MALTESE, + wxLANGUAGE_MANIPURI, + wxLANGUAGE_MAORI, + wxLANGUAGE_MARATHI, + wxLANGUAGE_MOLDAVIAN, + wxLANGUAGE_MONGOLIAN, + wxLANGUAGE_NAURU, + wxLANGUAGE_NEPALI, + wxLANGUAGE_NEPALI_INDIA, + wxLANGUAGE_NORWEGIAN_BOKMAL, + wxLANGUAGE_NORWEGIAN_NYNORSK, + wxLANGUAGE_OCCITAN, + wxLANGUAGE_ORIYA, + wxLANGUAGE_OROMO, + wxLANGUAGE_PASHTO, + wxLANGUAGE_POLISH, + wxLANGUAGE_PORTUGUESE, + wxLANGUAGE_PORTUGUESE_BRAZILIAN, + wxLANGUAGE_PUNJABI, + wxLANGUAGE_QUECHUA, + wxLANGUAGE_RHAETO_ROMANCE, + wxLANGUAGE_ROMANIAN, + wxLANGUAGE_RUSSIAN, + wxLANGUAGE_RUSSIAN_UKRAINE, + wxLANGUAGE_SAMOAN, + wxLANGUAGE_SANGHO, + wxLANGUAGE_SANSKRIT, + wxLANGUAGE_SCOTS_GAELIC, + wxLANGUAGE_SERBIAN, + wxLANGUAGE_SERBIAN_CYRILLIC, + wxLANGUAGE_SERBIAN_LATIN, + wxLANGUAGE_SERBO_CROATIAN, + wxLANGUAGE_SESOTHO, + wxLANGUAGE_SETSWANA, + wxLANGUAGE_SHONA, + wxLANGUAGE_SINDHI, + wxLANGUAGE_SINHALESE, + wxLANGUAGE_SISWATI, + wxLANGUAGE_SLOVAK, + wxLANGUAGE_SLOVENIAN, + wxLANGUAGE_SOMALI, + wxLANGUAGE_SPANISH, + wxLANGUAGE_SPANISH_ARGENTINA, + wxLANGUAGE_SPANISH_BOLIVIA, + wxLANGUAGE_SPANISH_CHILE, + wxLANGUAGE_SPANISH_COLOMBIA, + wxLANGUAGE_SPANISH_COSTA_RICA, + wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, + wxLANGUAGE_SPANISH_ECUADOR, + wxLANGUAGE_SPANISH_EL_SALVADOR, + wxLANGUAGE_SPANISH_GUATEMALA, + wxLANGUAGE_SPANISH_HONDURAS, + wxLANGUAGE_SPANISH_MEXICAN, + wxLANGUAGE_SPANISH_MODERN, + wxLANGUAGE_SPANISH_NICARAGUA, + wxLANGUAGE_SPANISH_PANAMA, + wxLANGUAGE_SPANISH_PARAGUAY, + wxLANGUAGE_SPANISH_PERU, + wxLANGUAGE_SPANISH_PUERTO_RICO, + wxLANGUAGE_SPANISH_URUGUAY, + wxLANGUAGE_SPANISH_US, + wxLANGUAGE_SPANISH_VENEZUELA, + wxLANGUAGE_SUNDANESE, + wxLANGUAGE_SWAHILI, + wxLANGUAGE_SWEDISH, + wxLANGUAGE_SWEDISH_FINLAND, + wxLANGUAGE_TAGALOG, + wxLANGUAGE_TAJIK, + wxLANGUAGE_TAMIL, + wxLANGUAGE_TATAR, + wxLANGUAGE_TELUGU, + wxLANGUAGE_THAI, + wxLANGUAGE_TIBETAN, + wxLANGUAGE_TIGRINYA, + wxLANGUAGE_TONGA, + wxLANGUAGE_TSONGA, + wxLANGUAGE_TURKISH, + wxLANGUAGE_TURKMEN, + wxLANGUAGE_TWI, + wxLANGUAGE_UIGHUR, + wxLANGUAGE_UKRAINIAN, + wxLANGUAGE_URDU, + wxLANGUAGE_URDU_INDIA, + wxLANGUAGE_URDU_PAKISTAN, + wxLANGUAGE_UZBEK, + wxLANGUAGE_UZBEK_CYRILLIC, + wxLANGUAGE_UZBEK_LATIN, + wxLANGUAGE_VIETNAMESE, + wxLANGUAGE_VOLAPUK, + wxLANGUAGE_WELSH, + wxLANGUAGE_WOLOF, + wxLANGUAGE_XHOSA, + wxLANGUAGE_YIDDISH, + wxLANGUAGE_YORUBA, + wxLANGUAGE_ZHUANG, + wxLANGUAGE_ZULU, + + // for custom, user-defined languages: + wxLANGUAGE_USER_DEFINED +}; + +// ---------------------------------------------------------------------------- +// wxLocaleCategory: the category of locale settings +// ---------------------------------------------------------------------------- +enum wxLocaleCategory +{ + // (any) numbers + wxLOCALE_CAT_NUMBER, + // date/time + wxLOCALE_CAT_DATE, + // monetary value + wxLOCALE_CAT_MONEY, + wxLOCALE_CAT_MAX +}; + +// ---------------------------------------------------------------------------- +// wxLocaleInfo: the items understood by wxLocale::GetInfo() +// ---------------------------------------------------------------------------- +enum wxLocaleInfo +{ + // the thounsands separator + wxLOCALE_THOUSANDS_SEP, + // the character used as decimal point + wxLOCALE_DECIMAL_POINT +}; + +// ---------------------------------------------------------------------------- +// wxLocale: encapsulates all language dependent settings, including current +// message catalogs, date, time and currency formats (TODO) &c +// ---------------------------------------------------------------------------- +enum wxLocaleInitFlags +{ + wxLOCALE_LOAD_DEFAULT = 0x0001, // load wxwin.mo? + wxLOCALE_CONV_ENCODING = 0x0002 // convert encoding on the fly? +}; + + +struct wxLanguageInfo +{ + int Language; // wxLanguage id + wxString CanonicalName; // Canonical name, e.g. fr_FR +#ifdef __WIN32__ + wxUint32 WinLang, // Win32 language identifiers + WinSublang; +#endif // __WIN32__ + wxString Description; // human-readable name of the language +}; + +/* FIXME - Ruby-ified method for AddLanguage, currently crashes +%extend wxLocale { + static int add_language(wxString& canonical_name, wxString& description, wxUint32 win_lang, wxUint32 win_sublang) + { +        wxLanguageInfo *lang_info; +        lang_info->CanonicalName = canonical_name; +        lang_info->Description = description; +#ifdef __WIN32__ + lang_info->WinLang = win_lang; + lang_info->WinSubLang = win_sublang; +#endif // __WIN32__ +        int identifier = wxLANGUAGE_USER_DEFINED + 1; +        // find an unused identifier +        while ( wxLocale::GetLanguageInfo(identifier) ) { identifier++; } +        lang_info->Language = identifier; +        wxLocale::AddLanguage(*lang_info); +        return identifier; + } +} +*/ + +%ignore wxLocale::AddLanguage; +%ignore wxLocale::AddCatalog; +%ignore wxLocale::GetString; +%ignore wxLocale::IsLoaded; +%ignore wxLocale::GetSystemEncodingName; + +%include "include/wxLocale.h" </ins></span></pre></div> <a id="trunkwxruby2swigclassesincludewxFonth"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/classes/include/wxFont.h (757 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/include/wxFont.h        2006-11-24 17:17:52 UTC (rev 757) +++ trunk/wxruby2/swig/classes/include/wxFont.h        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -8,134 +8,26 @@ </span><span class="cx"> class wxFont : public wxGDIObject </span><span class="cx"> { </span><span class="cx"> public: </span><del>-        /** -         * \brief Default constructor. -        */ - </del><span class="cx"> wxFont() ; </span><del>-        /** -         * \brief Creates a font object (see for the meaning of the last parameter). -         * \param int -         * \param int -         * \param int -         * \param int -         * \param const bool -         * \param const wxString& -         * \param wxFontEncoding -        */ - </del><span class="cx"> wxFont(int pointSize , int family , int style , int weight , const bool underline = false, const wxString& faceName = wxT(""), wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ; </span><del>-        /** -         * \brief Destructor. -        */ - </del><span class="cx"> virtual ~wxFont() ; </span><del>-        /** -         * \brief Returns if the font is a fixed width (or monospaced) font, - if it is a proportional one or font is invalid. -        */ - </del><span class="cx"> bool IsFixedWidth() const; </span><del>-        /** -         * \brief -        */ - </del><span class="cx"> static wxFontEncoding GetDefaultEncoding() ; </span><del>-        /** -         * \brief Returns the typeface name associated with the font, or the empty string if there is no -typeface information. -        */ - </del><span class="cx"> wxString GetFaceName() const; </span><del>-        /** -         * \brief Gets the font family. See for a list of valid -family identifiers. -        */ - </del><span class="cx"> int GetFamily() const; </span><del>-        /** -         * \brief Returns the platform-dependent string completely describing this font or an -empty string if the font wasn''t constructed using the native font description. -        */ - </del><span class="cx"> wxString GetNativeFontInfoDesc() const; </span><del>-        /** -         * \brief Gets the point size. -        */ - </del><span class="cx"> int GetPointSize() const; </span><del>-        /** -         * \brief Gets the font style. See for a list of valid -styles. -        */ - </del><span class="cx"> int GetStyle() const; </span><del>-        /** -         * \brief Returns true if the font is underlined, false otherwise. -        */ - </del><span class="cx"> bool GetUnderlined() const; </span><del>-        /** -         * \brief Gets the font weight. See for a list of valid -weight identifiers. -        */ - </del><span class="cx"> int GetWeight() const; </span><del>-        /** -         * \brief Returns if this object is a valid font, otherwise. -        */ - </del><span class="cx"> bool Ok() const; </span><del>-        /** -         * \brief -         * \param wxFontEncoding -        */ - </del><span class="cx"> static void SetDefaultEncoding(wxFontEncoding encoding ) ; </span><del>-        /** -         * \brief -         * \param const wxString& -        */ - </del><span class="cx"> void SetFaceName(const wxString& faceName ) ; </span><del>-        /** -         * \brief -         * \param int -        */ - </del><span class="cx"> void SetFamily(int family ) ; </span><del>-        /** -         * \brief Creates the font corresponding to the given native font description string -which must have been previously returned by - . If the string is -invalid, font is unchanged. -         * \param const wxString& -        */ - </del><span class="cx"> void SetNativeFontInfo(const wxString& info ) ; </span><del>-        /** -         * \brief Sets the point size. -         * \param int -        */ - </del><span class="cx"> void SetPointSize(int pointSize ) ; </span><del>-        /** -         * \brief Sets the font style. -         * \param int -        */ - </del><span class="cx"> void SetStyle(int style ) ; </span><del>-        /** -         * \brief Sets underlining. -         * \param const bool -        */ - </del><span class="cx"> void SetUnderlined(const bool underlined ) ; </span><del>-        /** -         * \brief Sets the font weight. -         * \param int -        */ - </del><span class="cx"> void SetWeight(int weight ) ; </span><span class="cx"> }; </span><span class="cx"> </span></span></pre></div> <a id="trunkwxruby2swigclassesincludewxLocaleh"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/classes/include/wxLocale.h (757 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/include/wxLocale.h        2006-11-24 17:17:52 UTC (rev 757) +++ trunk/wxruby2/swig/classes/include/wxLocale.h        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -8,253 +8,27 @@ </span><span class="cx"> class wxLocale </span><span class="cx"> { </span><span class="cx"> public: </span><del>-        /** -         * \brief This is the default constructor and it does nothing to initialize the object: - must be used to do that. -        */ - </del><span class="cx"> wxLocale() ; </span><del>-        /** -         * \brief See for parameters description. -         * \param int -         * \param int -        */ - </del><span class="cx"> wxLocale(int language , int flags = wxLOCALE_LOAD_DEFAULT) ; </span><del>-        /** -         * \brief See for parameters description. - -The call of this function has several global side effects which you should -understand: first of all, the application locale is changed - note that this -will affect many of standard C library functions such as printf() or strftime(). -Second, this wxLocale object becomes the new current global locale for the -application and so all subsequent calls to wxGetTranslation() will try to -translate the messages using the message catalogs for this locale. -         * \param const char -         * \param const char -         * \param const char -         * \param bool -         * \param bool -        */ - - wxLocale(const char *szName , const char *szShort = NULL, const char *szLocale = NULL, bool bLoadDefault = true, bool bConvertEncoding = false) ; -        /** -         * \brief The destructor, like the constructor, also has global side effects: the previously -set locale is restored and so the changes described in - documentation are rolled back. -        */ - </del><ins>+ // wxLocale(const char *szName , const char *szShort = NULL, const char *szLocale = NULL, bool bLoadDefault = true, bool bConvertEncoding = false) ; </ins><span class="cx"> virtual ~wxLocale() ; </span><del>-        /** -         * \brief Add a catalog for use with the current locale: it is searched for in standard -places (current directory first, then the system one), but you may also prepend -additional directories to the search path with - . - -All loaded catalogs will be used for message lookup by GetString() for the -current locale. - -Returns true if catalog was successfully loaded, false otherwise (which might -mean that the catalog is not found or that it isn''t in the correct format). -         * \param const char -        */ - </del><span class="cx"> bool AddCatalog(const char *szDomain ) ; </span><del>-        /** -         * \brief Add a prefix to the catalog lookup path: the message catalog files will be -looked up under prefix/<lang>/LC_MESSAGES, prefix/LC_MESSAGES and prefix -(in this order). - -This only applies to subsequent invocations of AddCatalog()! -         * \param const wxString& -        */ - - void AddCatalogLookupPathPrefix(const wxString& prefix ) ; -        /** -         * \brief Adds custom, user-defined language to the database of known languages. This -database is used in conjunction with the first form of - . - -wxLanguageInfo is defined as follows: - - - - - should be greater than wxLANGUAGE_USER_DEFINED. - -\perlnote{In wxPerl Wx::LanguageInfo has only one method:\par -Wx::LanguageInfo->new( language, canonicalName, WinLang, WinSubLang, Description )} -         * \param const wxLanguageInfo& -        */ - </del><span class="cx"> static void AddLanguage(const wxLanguageInfo& info ) ; </span><del>-        /** -         * \brief This function may be used to find the language description structure for the -given locale, specified either as a two letter ISO language code (for example, -"pt"), a language code followed by the country code ("pt_BR") or a full, human -readable, language description ("Portuguese-Brazil"). - -Returns the information for the given language or if this language -is unknown. Note that even if the returned pointer is valid, the caller should - delete it. -         * \param const wxString& -        */ - </del><span class="cx"> static wxLanguageInfo * FindLanguageInfo(const wxString& locale ) const; </span><del>-        /** -         * \brief Returns the canonical form of current locale name. Canonical form is the -one that is used on UNIX systems: it is a two- or five-letter string in xx or -xx_YY format, where xx is ISO 639 code of language and YY is ISO 3166 code of -the country. Examples are "en", "en_GB", "en_US" or "fr_FR". - -This form is internally used when looking up message catalogs. - -Compare . -        */ - </del><span class="cx"> wxString GetCanonicalName() const; </span><del>-        /** -         * \brief Returns constant of current language. -Note that you can call this function only if you used the form of - that takes wxLanguage argument. -        */ - </del><span class="cx"> int GetLanguage() const; </span><del>-        /** -         * \brief Returns a pointer to wxLanguageInfo structure containing information about the -given language or if this language is unknown. Note that even if the -returned pointer is valid, the caller should delete it. - -See for the wxLanguageInfo -description. -         * \param int -        */ - </del><span class="cx"> static wxLanguageInfo * GetLanguageInfo(int lang ) const; </span><del>-        /** -         * \brief Returns English name of the given language or empty string if this -language is unknown. -         * \param int -        */ - </del><span class="cx"> static wxString GetLanguageName(int lang ) const; </span><del>-        /** -         * \brief Returns the locale name as passed to the constructor or - . This is full, human-readable name, -e.g. "English" or "French". -        */ - </del><span class="cx"> const char* GetLocale() const; </span><del>-        /** -         * \brief Returns the current short name for the locale (as given to the constructor or -the Init() function). -        */ - </del><span class="cx"> const wxString& GetName() const; </span><del>-        /** -         * \brief Retrieves the translation for a string in all loaded domains unless the szDomain -parameter is specified (and then only this catalog/domain is searched). - -Returns original string if translation is not available -(in this case an error message is generated the first time -a string is not found; use to suppress it). -         * \param const char -         * \param const char -        */ - </del><span class="cx"> const char* GetString(const char *szOrigString , const char *szDomain = NULL) const; </span><del>-        /** -         * \brief Returns current platform-specific locale name as passed to setlocale(). - -Compare . -        */ - </del><span class="cx"> wxString GetSysName() const; </span><del>-        /** -         * \brief Tries to detect the user''s default font encoding. -Returns value or - if it couldn''t be determined. -        */ - </del><span class="cx"> static wxFontEncoding GetSystemEncoding() const; </span><del>-        /** -         * \brief Tries to detect the name of the user''s default font encoding. This string isn''t -particularly useful for the application as its form is platform-dependent and -so you should probably use - instead. - -Returns a user-readable string value or an empty string if it couldn''t be -determined. -        */ - </del><span class="cx"> static wxString GetSystemEncodingName() const; </span><del>-        /** -         * \brief Tries to detect the user''s default language setting. -Returns value or - if the language-guessing algorithm failed. -        */ - </del><span class="cx"> static int GetSystemLanguage() const; </span><del>-        /** -         * \brief -         * \param int -         * \param int -        */ - </del><span class="cx"> bool Init(int language = wxLANGUAGE_DEFAULT, int flags = wxLOCALE_LOAD_DEFAULT) ; </span><del>-        /** -         * \brief The second form is deprecated, use the first one unless you know what you are -doing. - - - - - - - - - - - - - - - - - - - -The call of this function has several global side effects which you should -understand: first of all, the application locale is changed - note that this -will affect many of standard C library functions such as printf() or strftime(). -Second, this wxLocale object becomes the new current global locale for the -application and so all subsequent calls to wxGetTranslation() will try to -translate the messages using the message catalogs for this locale. - -Returns true on success or false if the given locale couldn''t be set. -         * \param const char -         * \param const char -         * \param const char -         * \param bool -         * \param bool -        */ - - bool Init(const char *szName , const char *szShort = NULL, const char *szLocale = NULL, bool bLoadDefault = true, bool bConvertEncoding = false) ; -        /** -         * \brief Check if the given catalog is loaded, and returns true if it is. - -According to GNU gettext tradition, each catalog -normally corresponds to ''domain'' which is more or less the application name. - -See also: -         * \param const char* -        */ - </del><ins>+ // bool Init(const char *szName , const char *szShort = NULL, const char *szLocale = NULL, bool bLoadDefault = true, bool bConvertEncoding = false) ; </ins><span class="cx"> bool IsLoaded(const char* domain ) const; </span><del>-        /** -         * \brief Returns true if the locale could be set successfully. -        */ - </del><span class="cx"> bool IsOk() const; </span><span class="cx"> }; </span><span class="cx"> </span></span></pre></div> <a id="trunkwxruby2swigtypedefsi"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/typedefs.i (757 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/typedefs.i        2006-11-24 17:17:52 UTC (rev 757) +++ trunk/wxruby2/swig/typedefs.i        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -21,3 +21,4 @@ </span><span class="cx"> enum wxTextAttrAlignment; </span><span class="cx"> enum wxSashDragStatus; </span><span class="cx"> typedef unsigned int wxUint32; // Should be correct on all platforms </span><ins>+enum wxFontEncoding; </ins></span></pre></div> <a id="trunkwxruby2teststest_intlrb"></a> <div class="addfile"><h4>Added: trunk/wxruby2/tests/test_intl.rb (0 => 758)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/tests/test_intl.rb         (rev 0) +++ trunk/wxruby2/tests/test_intl.rb        2006-11-26 09:47:32 UTC (rev 758) </span><span class="lines">@@ -0,0 +1,100 @@ </span><ins>+require ''test/unit'' +require ''test/unit/ui/console/testrunner'' +require ''wx'' +class TestApp < Wx::App + attr_accessor :test_class + def on_init + Test::Unit::UI::Console::TestRunner.run(self.test_class) + end +end + +class TestInternationalisation < Test::Unit::TestCase + def test_encodings + default = Wx::Font.get_default_encoding + assert_kind_of(Integer, default) + assert_kind_of(String, Wx::Font.get_default_encoding_name) + assert_match(/\A[-A-Z0-9]+\z/, Wx::Font.get_default_encoding_name) + + Wx::Font.set_default_encoding(Wx::FONTENCODING_UTF8) + assert_equal(Wx::FONTENCODING_UTF8, Wx::Font.get_default_encoding) + assert_equal(''UTF8'', Wx::Font.get_default_encoding_name) + + Wx::Font.set_default_encoding(default) + assert_equal(default, Wx::Font.get_default_encoding) + + Wx::Font.set_default_encoding_name(''ISO-8859-1'') + assert_equal(Wx::FONTENCODING_ISO8859_1, Wx::Font.get_default_encoding) + assert_equal(''ISO-8859-1'', Wx::Font.get_default_encoding_name) + + Wx::Font.set_default_encoding(default) + end + + def test_language_info + locale_info = Wx::Locale.find_language_info(''en'') + assert_equal(''English'', locale_info.description) + + locale_info = Wx::Locale.find_language_info(''pt_BR'') + assert_equal(''Portuguese (Brazilian)'', locale_info.description) + + locale_info = Wx::Locale.find_language_info(''ja'') + assert_equal(''Japanese'', locale_info.description) + + assert_nil( Wx::Locale.find_language_info(''xx'') ) + end + + def test_add_language_info + # FIXME - typemaps for wxString are not picked up when SWIG converts + # the struct definition; so maybe do an %extend for this method that + # accepts string canonical name and description and Win32 + # identifiers, and returns an integer id. See Locale.i + language_marain = Wx::Locale.add_language(''ma_MA'', ''Marain'', + 0, 0) + assert_kind_of(Integer, language_marain) + lang_info = Wx::Locale.find_language_info(''ma_MA'') + assert_equal(Wx::LANGUAGE_MARAIN, lang_info.language) + assert_equal(''ma_MA'', lang_info.canonical_name) + assert_equal(''Marain'', lang_info.description) + end + + def test_get_system_language + sys_lang = Wx::Locale.get_system_language + assert_kind_of(Fixnum, sys_lang) + + assert_kind_of(String, Wx::Locale.get_system_language_name) + + assert_kind_of(Integer, Wx::Locale.get_system_encoding) + assert_kind_of(String, Wx::Locale.get_system_encoding_name) + assert_match(/\A[-A-Z0-9]+\z/, Wx::Locale.get_system_encoding_name) + end + + def test_set_locales + time = Time.local(2006, 10, 25, 16, 48, 12) + + # setting via Locale.new + locale = Wx::Locale.new(Wx::LANGUAGE_DANISH) + assert_equal(''da_DK'', locale.get_canonical_name) + assert_equal(Wx::LANGUAGE_DANISH, locale.get_language) + assert_equal(''Danish'', locale.get_language_name) + assert_equal(''25.10.2006'', time.strftime(''%x'')) + + # setting via Locale.set_locale + locale = Wx::Locale.set_locale(''en_GB'') + assert_equal(''en_GB'', locale.get_canonical_name) + assert_equal(Wx::LANGUAGE_ENGLISH, locale.get_language) + assert_equal(''English'', locale.get_language_name) + assert_equal(''25/10/2006'', time.strftime(''%x'')) + + locale = Wx::Locale.set_locale(''en_US'') + assert_equal(''en_US'', locale.get_canonical_name) + assert_equal(Wx::LANGUAGE_ENGLISH_US, locale.get_language) + assert_equal(''English (U.S.)'', locale.get_language_name) + assert_equal(''10/25/2006'', time.strftime(''%x'')) + + assert_raises(ArgumentError) { Wx::Locale.set_locale(''bad'') } + locale = Wx::Locale.new(Wx::LANGUAGE_DEFAULT) + end +end + +app = TestApp.new +app.test_class = TestInternationalisation +app.main_loop </ins></span></pre> </div> </div> </body> </html>
Possibly Parallel Threads
- [724] trunk/wxruby2: Initial commit of HtmlWindow functionality
- [1127] trunk/wxruby2: Move shared C++ GC functions into separate file included into wx.i
- [816] trunk/wxruby2: Added AcceleratorTable and AcceleratorTable classes, plus documentation
- [904] branches/wxruby2/wxwidgets_282: Changes in Wx::Colour API 2.6 -> 2.8
- [1135] trunk/wxruby2/swig/mark_free_impl.i: Convert from DOS to Unix newlines