File: class-pangolanguage.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (50 lines) | stat: -rw-r--r-- 13,064 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>pango.Language</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="pango-class-reference.html" title="The pango Class Reference"><link rel="previous" href="class-pangoglyphstring.html" title="pango.GlyphString"><link rel="next" href="class-pangolayout.html" title="pango.Layout"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">pango.Language</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-pangoglyphstring.html">Prev</a></td><th width="60%" align="center">The pango Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-pangolayout.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-pangolanguage"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>pango.Language</h2><p>pango.Language &#8212; an object that represents a language tag.</p></div><div class="refsect1" lang="en"><a name="id3055309"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">pango.Language</span></span>(<span class="ooclass"><span class="classname">gobject.GBoxed</span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-pangolanguage.html#constructor-pangolanguage" title="Constructor">pango.Language</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>language</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-pangolanguage.html#method-pangolanguage--matches" title="pango.Language.matches">matches</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>range_list</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-pangolanguage.html#method-pangolanguage--to-string" title="pango.Language.matches">to_string</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
<span class="bold"><b>Functions</b></span>

<code class="methodsynopsis">    def <span class="methodname"><a href="class-pangolanguage.html#function-pango--pango-language-from-string" title="pango.pango_language_from_string">pango.pango_language_from_string</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>language</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-pangolanguage.html#function-pango--pango-language-matches" title="pango.pango_language_matches">pango.pango_language_matches</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>language</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>range_list</tt></b></span></span>)</code></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3055426"></a><h2>Description</h2><p>A <a href="class-pangolanguage.html" title="pango.Language"><tt class="classname">pango.Language</tt></a>
object represents a language tag meeting the RFC-3066 standard. The <a href="class-pangolanguage.html" title="pango.Language"><tt class="classname">pango.Language</tt></a>
can be retrieved from a <a href="class-pangocontext.html" title="pango.Context"><tt class="classname">pango.Context</tt></a> by
using the <a href="class-pangocontext.html#method-pangocontext--get-language" title="pango.Context.get_language"><tt class="methodname">pango.Context.get_language</tt>()</a> 
method or created using the <a href="class-pangolanguage.html#constructor-pangolanguage" title="Constructor">pango.Language</a>() constructor.
Example RFC-3066 language tags include: "en-us", "fr", and
"sgn-us-ma".</p></div><div class="refsect1" lang="en"><a name="constructor-pangolanguage"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">pango.Language</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>language</tt></b></span>&gt;</span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>language</tt></b>:</span></td><td>a string representing a language
tag</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-pangolanguage.html" title="pango.Language"><tt class="classname">pango.Language</tt></a>
object</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This constructor is available in PyGTK 2.4 and above.</p></div><p>Creates a new <a href="class-pangolanguage.html" title="pango.Language"><tt class="classname">pango.Language</tt></a>
object from the RFC-3066 language tag specified by
<i class="parameter"><tt>language</tt></i>. This constructor first canonicalizes the
string in <i class="parameter"><tt>language</tt></i> by converting it to lowercase,
mapping '_' to '-', and stripping all characters other than letters and
'-'.</p></div><div class="refsect1" lang="en"><a name="id3236858"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-pangolanguage--matches"></a><h3>pango.Language.matches</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">matches</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>range_list</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>&gt;range_list</tt></b>:</span></td><td>a list of language ranges, separated by ';'
characters.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if a match was
found.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">matches</tt>() method returns
<tt class="literal">TRUE</tt> if the language matches one of the language ranges
in the list specified by <i class="parameter"><tt>range_list</tt></i>.A language tag is
considered to match a range in the list if</p><div class="itemizedlist"><ul type="disc"><li>the range is '*'</li><li>the range is exactly the same as the tag, or</li><li>the range is a prefix of the tag, and the character after
the matching portion of the tag is '-'</li></ul></div><p>each range must either be '*', or a canonicalized RFC-3066
language range (see the <a href="class-pangolanguage.html#constructor-pangolanguage" title="Constructor">pango.Language</a>() constructor for
more information).</p></div><div class="refsect2" lang="en"><a name="method-pangolanguage--to-string"></a><h3>pango.Language.matches</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">to_string</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the string representation of the language
tag</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">to_string</tt>() method returns a string
representation of the canonicalized language tag. See the <a href="class-pangolanguage.html#constructor-pangolanguage" title="Constructor">pango.Language</a>() constructor for
more information.</p></div></div><div class="refsect1" lang="en"><a name="id3237037"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-pango--pango-language-from-string"></a><h3>pango.pango_language_from_string</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">pango.pango_language_from_string</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>language</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>language</tt></b>:</span></td><td>a string representing a language
	  tag</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-pangolanguage.html" title="pango.Language"><tt class="classname">pango.Language</tt></a>
	  object</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is deprecated in PyGTK 2.4 and above. Use the
<a href="class-pangolanguage.html#constructor-pangolanguage" title="Constructor">pango.Language()</a>
constructor instead.</p></div><p>The <tt class="function">pango.pango_language_from_string</tt>()
function takes a RFC-3066 format language tag as a string (specified by
<i class="parameter"><tt>language</tt></i>) and converts it to a <a href="class-pangolanguage.html" title="pango.Language"><tt class="classname">pango.Language</tt></a>
object. This function first canonicalizes the string by converting it to
lowercase, mapping '_' to '-', and stripping all characters other than
letters and '-'.</p></div><div class="refsect2" lang="en"><a name="function-pango--pango-language-matches"></a><h3>pango.pango_language_matches</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">pango.pango_language_matches</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt></tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>language</tt></b>:</span></td><td> a language tag (see the <a href="class-pangolanguage.html#function-pango--pango-language-from-string" title="pango.pango_language_from_string"><tt class="function">pango.pango_language_from_string</tt>()</a>
	  function), <tt class="literal">None</tt> is allowed and matches nothing
	  but '*'</td></tr><tr><td><span class="term"><b class="parameter"><tt>range_list</tt></b>:</span></td><td> a list of language ranges, separated by ';'
	  characters. each element must either be '*', or a RFC 3066
	  language range canonicalized as by the <a href="class-pangolanguage.html#function-pango--pango-language-from-string" title="pango.pango_language_from_string"><tt class="function">pango.pango_language_from_string</tt>()</a>
	  function.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if a match was
	  found.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is deprecated in PyGTK 2.4 and above. Use the
<a href="class-pangolanguage.html#method-pangolanguage--matches" title="pango.Language.matches"><tt class="methodname">matches</tt>()</a>
method instead.</p></div><p>The <tt class="function">pango.pango_language_matches</tt>() function
checks if a language tag matches one of the elements in a list of language
ranges. A language tag is considered to match a range in the list if the
range is '*', the range is exactly the tag, or the range is a prefix of the
tag, and the character after the tag is '-'.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-pangoglyphstring.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="pango-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-pangolayout.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">pango.GlyphString</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">pango.Layout</td></tr></table></div></body></html>