diff options
Diffstat (limited to 'themes/openSUSE/src/dia_extralang.inc')
-rw-r--r-- | themes/openSUSE/src/dia_extralang.inc | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/themes/openSUSE/src/dia_extralang.inc b/themes/openSUSE/src/dia_extralang.inc new file mode 100644 index 0000000..f083d8c --- /dev/null +++ b/themes/openSUSE/src/dia_extralang.inc @@ -0,0 +1,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 |