summaryrefslogtreecommitdiff
path: root/themes/openSUSE/src/dia_extralang.inc
blob: f083d8c7152d6ffae29f51ef26250e844af59474 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%
% extra language switch button
%
% Iterate through the locales in config.extralang.locales array.
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Initialize.
%
% ( ) ==> ( )
%
/extralang.init {
  /extralang.current 0 def
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Get index in language menu.
%
% ( ) ==> ( )
%
/extralang.index {
  0 1 lang.items length 1 sub {
    lang.items over get config.extralang.locales extralang.current get eq { return } { pop } ifelse
  } for
  0
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Get language name.
%
% ( ) ==> ( )
%
/extralang.name {
  config.extralang.locales extralang.current get lang.getdefname
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Set a new language.
%
% ( ) ==> ( )
%
/extralang.update {
  xmenu.lang .xm_current extralang.index put
  lang.update
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Activate selected language.
%
% And also move to next language in list.
%
% ( ) => ( )
%
/panel.extralang {
  extralang.update
  % go to next language
  /extralang.current extralang.current 1 add config.extralang.locales length mod def
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Return width of panel entry.
%
% ( ) => ( width )
%
/panel.extralang.width {
  extralang.name strsize pop
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Redraw panel entry.
%
% ( panel ) => ( )
%
/panel.extralang.update {
  panel.text.moveto
  extralang.name show.rtl
} def