HTTP Server for Tux Droid
util.string.String.String Class Reference
Inheritance diagram for util.string.String.String:
Collaboration diagram for util.string.String.String:

Public Member Functions

def toUtf8 (text, detectConsole=False)
 
def isUtf8 (text)
 
def translate (text, fromLang, toLang, inConsole=False)
 
def autoTranslate (text, toLang, inConsole=False)
 
def getLanguage (text, default="en_US")
 
def getClipboardText (inConsole=False)
 
def getTranslatedClipboardText (toLang, inConsole=False)
 

Static Public Attributes

 toUtf8
 
 isUtf8
 
 translate
 
 autoTranslate
 
 getLanguage
 
 getClipboardText
 
 getTranslatedClipboardText
 

Static Private Attributes

 __languageFinder
 
 __textFilter
 

Detailed Description

Utilities for string data.

Member Function Documentation

◆ autoTranslate()

def util.string.String.String.autoTranslate (   text,
  toLang,
  inConsole = False 
)
Translate a text with auto-detection of the input text language.
@param text: Text to translate.
@param toLang: Language of the translated text.
@param inConsole: If the text will be showed in the console.
@return: The translated text in or empty string if fail.
    - If the text must be showed in the console, the output string is
      reencoded in the console encoding, otherwise it is encoded in
      'utf-8'.

◆ getClipboardText()

def util.string.String.String.getClipboardText (   inConsole = False)
Get the last copied text in the clipboard.
@return: A string.

◆ getLanguage()

def util.string.String.String.getLanguage (   text,
  default = "en_US" 
)
Find the language of a text.
@param text: Input text.
@param default: Default returned language if the function can't retrieve
    the text language.
@return: The text language.

◆ getTranslatedClipboardText()

def util.string.String.String.getTranslatedClipboardText (   toLang,
  inConsole = False 
)
Get the last copied text in the clipboard, translated with language
auto-detection.
@param toLang: Language of the translated text.
@param inConsole: If the text will be showed in the console.
@return: A string.

◆ isUtf8()

def util.string.String.String.isUtf8 (   text)
Check if the text is encoded in 'utf-8'.
@param text: Input text to check.
@return: A boolean.

◆ toUtf8()

def util.string.String.String.toUtf8 (   text,
  detectConsole = False 
)
Force the text encoding to 'utf-8'.
@param text: Input text in any encoding.
@return: The 'utf-8' text.

◆ translate()

def util.string.String.String.translate (   text,
  fromLang,
  toLang,
  inConsole = False 
)
Translate a text.
@param text: Text to translate.
@param fromLang: Language of the original text.
@param toLang: Language of the translated text.
@param inConsole: If the text will be showed in the console.
@return: The translated text in or empty string if fail.
    - If the text must be showed in the console, the output string is
      reencoded in the console encoding, otherwise it is encoded in
      'utf-8'.

Member Data Documentation

◆ __languageFinder

util.string.String.String.__languageFinder
staticprivate

◆ __textFilter

util.string.String.String.__textFilter
staticprivate

◆ autoTranslate

util.string.String.String.autoTranslate
static

◆ getClipboardText

util.string.String.String.getClipboardText
static

◆ getLanguage

util.string.String.String.getLanguage
static

◆ getTranslatedClipboardText

util.string.String.String.getTranslatedClipboardText
static

◆ isUtf8

util.string.String.String.isUtf8
static

◆ toUtf8

util.string.String.String.toUtf8
static

◆ translate

util.string.String.String.translate
static

The documentation for this class was generated from the following file: