summaryrefslogtreecommitdiffstats
path: root/doc/admin/locale/usage.rst
blob: 2afad86cb4bffa6ab8b7901de615db4608b34e0c (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
OpenLMI Locale usage
====================

Some common use cases are described in the following parts.

Getting locale settings
-----------------------
Create connection, get instance (assuming the default namespace 'root/cimv2' is used)::

    c = connect("https://myhost")
    # optionally create namespace alias
    ns = c.root.cimv2
    locale = ns.LMI_Locale.first_instance()

Print what you're interested in::

    # get LANG setting
    print locale.Lang
    # get X11Layouts
    print locale.X11Layouts
    # get VConsoleKeymap
    print locale.VConsoleKeymap

Or print everything::

    # get all available settings
    locale.doc()

Setting system locale
---------------------
Set LANG and/or set individual locale variables. Lang, LCCType, LCAddress, LCNumeric,
LCTelephone, LCCollate, LCPaper, LCMonetary, LCTime, LCMessages, LCIdentification,
LCName and LCMeasurement properties correspond to likewise named Linux locale
environmental variables::

    # set LANG (LANG value is used also for all other locale categories by default)
    locale.SetLocale(Lang="en_US.UTF-8")
    # set LANG and set different value for LC_TELEPHONE
    # note that SetLocale() clears previous setting - if you want to preserve
    # LANG value, you have to set it again
    locale.SetLocale(Lang="en_US.UTF-8",LCTelephone="cs_CZ.UTF-8")

Setting default key mapping of the X11 servers
----------------------------------------------
Set default key mapping for X11 server::

    locale.SetX11Keyboard(Layouts="de")

Optionally set keyboard model and variant::

    locale.SetX11Keyboard(Layouts="us",Model="dellsk8125",Variant="qwertz")

Set more than one layout and set option for switching between them::

    locale.SetX11Keyboard(Layouts="us,cz,de",Options="grp:alt_shift_toggle")

You can set Convert parameter to 'True', mapping for virtual console will be set
also then (nearest console keyboard setting for the chosen X11 setting)::

    locale.SetX11Keyboard(Layouts="us",Convert="True")

Setting default key mapping of the virtual console
--------------------------------------------------
Set default key mapping for virtual console::

    locale.SetVConsoleKeyboard(Keymap="us")

Again, setting Convert to 'True' will set the nearest X11 keyboard setting for
the chosen console setting::

    locale.SetVConsoleKeyboard(Keymap="us",Convert="True")