Skip to content

Commit

Permalink
provide better API for getting keyboard map info (fate#325748)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsrain committed Nov 9, 2018
1 parent 0424782 commit 4d8533f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions keyboard/src/modules/Keyboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,27 @@ def get_lang2keyboard
Builtins.union(base_lang2keyboard, Language.GetLang2KeyboardMap(true))
end

# Get the default key map for selected language
#
# @param the locale, e.g. cs_CZ
#
# @return the expected key map, e.g. cz-us-qwertz.map.gz
#
def GetKeymapForLanguage(sys_language)
keyboard = GetKeyboardForLanguage(sys_language, "us")
keyboards = get_reduced_keyboard_db

Builtins.y2debug("reduced kbd db %1", keyboards)
# Get the entry from the reduced local map for the given language.
#
kbd_descr = Ops.get_list(keyboards, keyboard, [])
Builtins.y2milestone( "Description for keyboard <%1>: <%2>", keyboard, kbd_descr)

if kbd_descr != [] # keyboard found
return Ops.get_string(kbd_descr, [1, "ncurses"], "us.map.gz")
end
return "us.map.gz"
end

# GetKeyboardForLanguage()
#
Expand Down Expand Up @@ -1320,6 +1339,7 @@ def Summary
publish :function => :SetKeyboardForLanguage, :type => "void (string)"
publish :function => :SetKeyboardForLang, :type => "void (string)"
publish :function => :SetKeyboardDefault, :type => "void ()"
publish :function => :GetKeymapForLanguage, :type => "string(string)"
publish :function => :Import, :type => "boolean (map, ...)"
publish :function => :Export, :type => "map ()"
publish :function => :Summary, :type => "string ()"
Expand Down
5 changes: 5 additions & 0 deletions package/yast2-country.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Nov 9 07:52:29 UTC 2018 - jsrain@suse.cz

- provide better API for getting keyboard map info (fate#325748)

-------------------------------------------------------------------
Fri Oct 26 13:21:47 UTC 2018 - jreidinger@suse.com

Expand Down

0 comments on commit 4d8533f

Please sign in to comment.