YaST2 Developers Documentation: Language

Language

modules/Language.ycp
This module does all language related stuff:
  • Klaus Kaempf
  • Thomas Roelz
  • Maintainer: Jiri Suchomel

This module has an unstable interface.

Imports

  • AsciiFile
  • Directory
  • Encoding
  • FileUtils
  • HTML
  • InstExtensionImage
  • Linuxrc
  • Misc
  • Mode
  • PackageCallbacks
  • PackageSystem
  • Popup
  • ProductFeatures
  • SlideShow
  • Stage

Global Variables

Global Functions

Local Variables

Local Functions

global language -> string

currently selected language

global language_on_entry -> string

original language

global preselected -> string

language preselected in /etc/install.inf

local name -> string

user readable description of language

local default_language -> string

Default language to be restored with MakeProposal.

local rootlang -> string

Default settings for ROOT_USES_LANG in /etc/sysconfig/language

global languages -> string

Default settings for INSTALLED_LANGUAGES in /etc/sysconfig/language

global languages_on_entry -> string

Original value of INSTALLED_LANGUAGES

local use_utf8 -> boolean

Use utf8 in locale

local text_mode -> boolean

ncurses mode

global selection_skipped -> boolean

Was the initial language selection skipped? (see bug 223258) (It can be, if the language was selected in linuxrc)

local translation_status -> map<string,integer>

level of translation completeness

global CJKLanguage (string lang) -> boolean

Check if the language is "CJK" (and thus could not be shown in text mode - see bug #102958)

Parameters:
lang
global GetTextMode () -> boolean

return the value of text_mode (true for ncurses)

local read_languages_map () -> void

Read language DB: translatable strings will be translated to current language

local ReadLanguageMap (string lang) -> map

Read only the map of one language

Parameters:
lang
global GetLanguagesMap (boolean force) -> map<string, list>

Return the whole map with language descriptions

Parameters:
force force new loading of the map from the files (forces the change of translations to current language)
local EnglishName (string code, string backup) -> string

Return English translation of given language (Fate 301789)

Parameters:
code
backup
local FillEnglishNames (string lang) -> void

Fill the map with English names of languages

Parameters:
lang
global GetLang2TimezoneMap (boolean force) -> map<string,string>

return the content of lang2timezone map (mapping of languages to their default (proposed) time zones)

Parameters:
force
global GetLang2KeyboardMap (boolean force) -> map<string,string>

return the content of lang2keyboard map (mapping of languages to their default (proposed) keyboard layouts)

Parameters:
force
global GetLocales () -> map<string,integer>

return the map of all supported countries and language codes

local GetLanguageExtensionFilename (string language) -> string

For given language, return the file name of language extension (image) to be downloaded to the inst-sys (FATE #302955: Split translations out of installation system)

Parameters:
language
global Set (string lang) -> void

Set module to selected language.

Parameters:
lang language string ISO code of language
global QuickSet (string lang) -> void

Set the language that was read from sysconfig, read only one needed language file

Parameters:
lang
global GetLocaleString (string lang) -> string

generate the whole locale string for given language according to DB (e.g. de_DE -> de_DE.UTF-8)

Parameters:
lang
global SetDefault () -> void

Store current language as default language.

global ReadSysconfigLanguage () -> string

Read the RC_LANG value from sysconfig and exctract language from it

Return value:
language
global ReadSysconfigValues () -> void

Read the rest of language values from sysconfig

global Language () -> void

Constructor

global Read (boolean really) -> boolean

Store the inital values; in normal mode, read from system was done in constructor

Parameters:
really : also read the values from the system
global Modified () -> boolean

was anything modified?

global PackagesModified () -> boolean

Does the modification of language(s) require installation of new packages? This test compares the list of original languages (primary+secondary) with the list after user's modifications

global GetExpertValues () -> map

GetExpertValues()

Return the values for the various expert settings in a map

Return value:
with values filled in
global SetExpertValues (map val) -> void

SetExpertValues()

Set the values of the various expert setting

Parameters:
val map with new values of expert settings
Return value:
global WfmSetGivenLanguage (string lang) -> void

WfmSetLanguag()

Set the given language in WFM and UI

Parameters:
lang
Return value:
-
global WfmSetLanguage () -> void

WfmSetLanguag()

Set the current language in WFM and UI

Return value:
-
global MakeProposal (boolean force_reset, boolean language_changed) -> list<string>

Return proposal string.

Parameters:
force_reset
language_changed
Return value:
user readable description. If force_reset is true reset the module to the language stored in default_language.
global MakeSimpleProposal () -> string

Return 'simple' proposal string.

Return value:
preformated description.
global GetName () -> string

return user readable description of language

global Selection () -> map<string, list>

Return a map of ids and names to build up a selection list for the user. The key is used later in the Set function to select this language. The name is a translated string.

Return value:
of $[ language : [ utf8-name, ascii-name] ...] for all known languages 'language' is the (2 or 5 char) ISO language code. 'utf8-name' is a user-readable (UTF-8 encoded !) string. 'ascii-name' is an english (ascii encoded !) string.
See
Set
global Save () -> void

Save state to target.

global PackagesInit (list<string> selected_languages) -> boolean

Initializes source and target, computes the packages necessary to install and uninstall, checks for disk space (#50745)

Parameters:
selected_languages
Return value:
false when there is not enough disk space for new packages
global PackagesCommit () -> boolean

Install and uninstall packages selected by Pkg::SetAdditionalLocales

global GetGivenLanguageCountry (string lang) -> string

de_DE@UTF-8 -> "DE"

Parameters:
lang
Return value:
country part of language
global GetLanguageCountry () -> string

de_DE@UTF-8 -> "DE"

Return value:
country part of language
global IncompleteTranslation (string lang) -> boolean

Returns true if translation for given language is not complete

Parameters:
lang
global CheckIncompleteTranslation (string lang) -> boolean

Checks if translation is complete and displays Continue/Cancel popup messsage if it is not return true if translation is OK or user agrees with the warning

Parameters:
lang
global Import (map settings) -> boolean

AutoYaST interface function: Get the Language configuration from a map.

Parameters:
settings imported map
Return value:
success
global Export () -> map

AutoYaST interface function: Return the Language configuration as a map.

Return value:
with the settings
global Summary () -> string

AutoYaST interface function: Return the summary of Language configuration as a map.

Return value:
summary string
global CheckLanguagesSupport (string selected_language) -> void

check if selected language has support on media (F301238) show a warning when not

Parameters:
selected_language
global SwitchToEnglishIfNeeded (boolean show_popup) -> boolean

Set current YaST language to English if method for showing text in current language is not supported (usually for CJK languages) See http://bugzilla.novell.com/show_bug.cgi?id=479529 for discussion

Parameters:
show_popup
Return value:
true if UI language was changed