Package yum :: Module i18n
[hide private]
[frames] | no frames]

Module i18n

source code

Functions [hide private]
 
dummy_wrapper(str)
Dummy Translation wrapper, just returning the same string.
source code
 
dummyP_wrapper(str1, str2, n)
Dummy Plural Translation wrapper, just returning the singular or plural string.
source code
 
__utf8_bisearch(ucs, table)
auxiliary function for binary search in interval table.
source code
 
__utf8_ucp_width(ucs)
Get the textual width of a ucs character.
source code
 
__utf8_iter_ints(msg) source code
 
__utf8_iter_ucs(msg) source code
 
utf8_width(msg)
Get the textual width of a utf8 string.
source code
 
utf8_width_chop(msg, chop=None)
Return the textual width of a utf8 string, chopping it to a specified value.
source code
 
utf8_width_fill(msg, fill, chop=None, left=True, prefix='', suffix='')
Expand a utf8 msg to a specified "width" or chop to same.
source code
 
utf8_valid(msg)
Return True/False is the text is valid utf8.
source code
 
_utf8_width_le(width, *args)
Minor speed hack, we often want to know "does X fit in Y".
source code
 
utf8_text_wrap(text, width=70, initial_indent='', subsequent_indent='')
Works like we want textwrap.wrap() to work, uses utf-8 data and doesn't screw up lists/blocks/etc.
source code
 
utf8_text_fill(text, *args, **kwargs)
Works like we want textwrap.fill() to work, uses utf-8 data and doesn't screw up lists/blocks/etc.
source code
 
to_unicode(obj, encoding='utf-8', errors='replace')
convert a 'str' to 'unicode'
source code
 
to_utf8(obj, errors='replace')
convert 'unicode' to an encoded utf-8 byte string
source code
 
to_unicode_maybe(obj, encoding='utf-8', errors='replace')
Don't ask don't tell, only use when you must
source code
 
to_str(obj)
Convert something to a string, if it isn't one.
source code
 
str_eq(a, b)
convert between unicode and not and compare them, w/o warning or being annoying
source code
Variables [hide private]
  __combining = ((768, 879), (1155, 1158), (1160, 1161), (1425, ...
  t = gettext.translation('yum', fallback= True)
  __package__ = 'yum'
Function Details [hide private]

utf8_width_chop(msg, chop=None)

source code 

Return the textual width of a utf8 string, chopping it to a specified value. This is what you want to use instead of %.*s, as it does the "right" thing with regard to utf-8 sequences. Eg. "%.*s" % (10, msg) <= becomes => "%s" % (utf8_width_chop(msg, 10))

utf8_width_fill(msg, fill, chop=None, left=True, prefix='', suffix='')

source code 
Expand a utf8 msg to a specified "width" or chop to same.
Expansion can be left or right. This is what you want to use instead of
%*.*s, as it does the "right" thing with regard to utf-8 sequences.
prefix and suffix should be used for "invisible" bytes, like
highlighting.
Eg.
"%-*.*s" % (10, 20, msg)
   <= becomes =>
"%s" % (utf8_width_fill(msg, 10, 20)).

"%20.10s" % (msg)
   <= becomes =>
"%s" % (utf8_width_fill(msg, 20, 10, left=False)).

"%s%.10s%s" % (prefix, msg, suffix)
   <= becomes =>
"%s" % (utf8_width_fill(msg, 0, 10, prefix=prefix, suffix=suffix)).

_utf8_width_le(width, *args)

source code 

Minor speed hack, we often want to know "does X fit in Y". It takes "a while" to work out a utf8_width() (see above), and we know that a utf8 character is always <= byte. So given:

assert bytes >= characters characters <= width?

...we can change to:

bytes <= width or characters <= width

...and bytes are much faster.


Variables Details [hide private]

__combining

Value:
((768, 879),
 (1155, 1158),
 (1160, 1161),
 (1425, 1469),
 (1471, 1471),
 (1473, 1474),
 (1476, 1477),
 (1479, 1479),
...