Skip to content

Commit

Permalink
Merge pull request #185 from jsrain/master
Browse files Browse the repository at this point in the history
provide better API for getting keyboard map info (fate#325748)
  • Loading branch information
jsrain committed Nov 9, 2018
2 parents 0424782 + da59798 commit 91e7fe9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
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 sys_language [String] the locale, e.g. cs_CZ
#
# @return [String] 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

log.debug("reduced kbd db: #{keyboards}")
# Get the entry from the reduced local map for the given language.
#
kbd_descr = keyboards[keyboard] || []
log.info( "Description for keyboard #{keyboard.inspect}: #{kbd_descr.inspect}")

if !kbd_descr.empty? # keyboard found
return Ops.get_string(kbd_descr, [1, "ncurses"], "us.map.gz")
end
"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
6 changes: 6 additions & 0 deletions package/yast2-country.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Nov 9 07:52:29 UTC 2018 - jsrain@suse.cz

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

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

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-country.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-country
Version: 4.1.0
Version: 4.1.1
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down

0 comments on commit 91e7fe9

Please sign in to comment.