data/TWiki/TWikiI18NDotPm.txt,v
changeset 0 414e01d06fd5
equal deleted inserted replaced
-1:000000000000 0:414e01d06fd5
       
     1 head	1.2;
       
     2 access;
       
     3 symbols;
       
     4 locks; strict;
       
     5 comment	@# @;
       
     6 
       
     7 
       
     8 1.2
       
     9 date	2008.01.22.03.21.27;	author TWikiContributor;	state Exp;
       
    10 branches;
       
    11 next	1.1;
       
    12 
       
    13 1.1
       
    14 date	2006.02.01.12.01.25;	author TWikiContributor;	state Exp;
       
    15 branches;
       
    16 next	;
       
    17 
       
    18 
       
    19 desc
       
    20 @new-topic
       
    21 @
       
    22 
       
    23 
       
    24 1.2
       
    25 log
       
    26 @buildrelease
       
    27 @
       
    28 text
       
    29 @---+ Package =TWiki::I18N=
       
    30 
       
    31 Support for strings translation and language detection.
       
    32 
       
    33 
       
    34 %TOC%
       
    35 
       
    36 ---++ ClassMethod *available_languages* <tt></tt>
       
    37 
       
    38 Lists languages tags for languages available at TWiki installation. Returns a
       
    39 list containing the tags of the available languages.
       
    40 
       
    41 __Note__: the languages available to users are determined in the =configure=
       
    42 interface.
       
    43 
       
    44 
       
    45 
       
    46 ---++ ClassMethod *new* <tt>($session)</tt>
       
    47 
       
    48 Constructor. Gets the language object corresponding to the current users
       
    49 language. If $session is not a TWiki object reference, just calls
       
    50 Local::Maketext::new (the superclass constructor)
       
    51 
       
    52 
       
    53 
       
    54 ---++ ObjectMethod *finish* <tt>()</tt>
       
    55 Break circular references.
       
    56 
       
    57 
       
    58 
       
    59 ---++ ObjectMethod *maketext* <tt>($text) -> $translation</tt>
       
    60 
       
    61 Translates the given string (assumed to be written in English) into the
       
    62 current language, as detected in the constructor, and converts it into
       
    63 the site charset.
       
    64 
       
    65 Wraps around Locale::Maketext's maketext method, adding charset conversion and checking
       
    66 
       
    67 Return value: translated string, or the argument itself if no translation is
       
    68 found for thet argument.
       
    69 
       
    70 
       
    71 
       
    72 ---++ ObjectMethod *language* <tt>() -> $language_tag</tt>
       
    73 
       
    74 Indicates the language tag of the current user's language, as detected from the
       
    75 information sent by the browser. Returns the empty string if the language
       
    76 could not be determined.
       
    77 
       
    78 
       
    79 
       
    80 ---++ ObjectMethod *enabled_languages* <tt>() -> %languages</tt>
       
    81 
       
    82 Returns an array with language tags as keys and language (native) names as
       
    83 values, for all the languages enabled in this TWiki.TWikiSite. Useful for
       
    84 listing available languages to the user.
       
    85 
       
    86 
       
    87 
       
    88 ---++ ObjectMethod *fromSiteCharSet* <tt>($text) -> $encoded</tt>
       
    89 
       
    90 This method receives =$text=, assumed to be encoded in {Site}{CharSet}, and
       
    91 converts it to a internal representation.
       
    92 
       
    93 Currently this representation will be a UTF-8 string, but this may change in
       
    94 the future. This way, you can't assume any property on the returned value, and
       
    95 should only use the returned value of this function as input to toSiteCharSet.
       
    96 If you change the returnd value, either by removing, updating or appending
       
    97 characters, be sure to touch only ASCII characters (i.e., characters that have
       
    98 ord() less than 128).
       
    99 
       
   100 
       
   101 
       
   102 
       
   103 ---++ ObjectMethod *toSiteCharSet* <tt>($encoded) -> $text</tt>
       
   104 
       
   105 This method receives a string, assumed to be encoded in TWiki's internal string
       
   106 representation (as generated by the fromSiteCharSet method, and converts it
       
   107 into {Site}{CharSet}.
       
   108 
       
   109 When converting into {Site}{CharSet}, characters that are not present at that
       
   110 charset are represented as HTML numerical character entities (NCR's), in the
       
   111 format <code>&amp;#NNNN;</code>, where NNNN is the character's Unicode
       
   112 codepoint.
       
   113 
       
   114 See also: the =fromSiteCharSet= method.
       
   115 
       
   116 
       
   117 @
       
   118 
       
   119 
       
   120 1.1
       
   121 log
       
   122 @buildrelease
       
   123 @
       
   124 text
       
   125 @d18 1
       
   126 a18 1
       
   127 ---++ ClassMethod *get* <tt>($session)</tt>
       
   128 d20 8
       
   129 a27 1
       
   130 Constructor. Gets the language object corresponding to the current user's language.
       
   131 @