Localize keyboard layout names in Keymap preferences
This commit is contained in:
@@ -191,54 +191,13 @@ for keymapAlias in $(HAIKU_KEYMAP_ALIASES) {
|
||||
AddSymlinkToPackage data Keymaps : $(aliasedTo:BSM) : $(keymapAlias:BSM) ;
|
||||
}
|
||||
|
||||
# Copy keyboard layout files to the image one-by-one.
|
||||
local keyboardLayoutsDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ] ;
|
||||
local keyboardLayoutFiles =
|
||||
"Generic 104-key"
|
||||
"Generic 105-key International"
|
||||
"Kinesis Advantage"
|
||||
"Kinesis Ergo Elan International"
|
||||
"TypeMatrix 2030" ;
|
||||
keyboardLayoutFiles = $(keyboardLayoutFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(keyboardLayoutFiles) = $(keyboardLayoutsDir) ;
|
||||
# keyboard layouts
|
||||
AddFilesToPackage data KeyboardLayouts
|
||||
: $(keyboardLayoutFiles) ;
|
||||
|
||||
# Add Apple Aluminum keyboard layout files to the image in an Apple Aluminum
|
||||
# subdirectory. The subdirectory is turned into a submenu in the Layout menu
|
||||
# of the Keymap preference app.
|
||||
local appleAluminumDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts
|
||||
Apple\ Aluminum ] ;
|
||||
local appleAluminumFiles =
|
||||
"Apple Aluminium Extended International"
|
||||
"Apple Aluminium International"
|
||||
"Apple Aluminum (US)"
|
||||
"Apple Aluminum Extended (US)" ;
|
||||
appleAluminumFiles = $(appleAluminumFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(appleAluminumFiles) = $(appleAluminumDir) ;
|
||||
: $(HAIKU_KEYBOARD_LAYOUT_FILES) ;
|
||||
AddFilesToPackage data KeyboardLayouts Apple\ Aluminum
|
||||
: $(appleAluminumFiles) ;
|
||||
|
||||
# Add ThinkPad keyboard layout files to the image in a ThinkPad
|
||||
# subdirectory. The subdirectory is turned into a submenu in the Layout menu
|
||||
# of the Keymap preference app.
|
||||
local thinkpadDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ThinkPad ] ;
|
||||
local thinkPadFiles =
|
||||
"ThinkPad (US)"
|
||||
"ThinkPad International"
|
||||
"ThinkPad T400s (US)"
|
||||
"ThinkPad T400s International"
|
||||
"ThinkPad X1 (US)"
|
||||
"ThinkPad X1 International"
|
||||
"ThinkPad X100e (US)"
|
||||
"ThinkPad X100e International" ;
|
||||
thinkPadFiles = $(thinkPadFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(thinkPadFiles) = $(thinkpadDir) ;
|
||||
: $(HAIKU_APPLE_ALUMINUM_KEYBOARD_LAYOUT_FILES) ;
|
||||
AddFilesToPackage data KeyboardLayouts ThinkPad
|
||||
: $(thinkPadFiles) ;
|
||||
: $(HAIKU_THINKPAD_KEYBOARD_LAYOUT_FILES) ;
|
||||
|
||||
# boot module links
|
||||
AddBootModuleSymlinksToPackage
|
||||
|
||||
@@ -156,54 +156,13 @@ for keymapAlias in $(HAIKU_KEYMAP_ALIASES) {
|
||||
AddSymlinkToPackage data Keymaps : $(aliasedTo:BSM) : $(keymapAlias:BSM) ;
|
||||
}
|
||||
|
||||
# Copy keyboard layout files to the image one-by-one.
|
||||
local keyboardLayoutsDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ] ;
|
||||
local keyboardLayoutFiles =
|
||||
"Generic 104-key"
|
||||
"Generic 105-key International"
|
||||
"Kinesis Advantage"
|
||||
"Kinesis Ergo Elan International"
|
||||
"TypeMatrix 2030" ;
|
||||
keyboardLayoutFiles = $(keyboardLayoutFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(keyboardLayoutFiles) = $(keyboardLayoutsDir) ;
|
||||
# keyboard layouts
|
||||
AddFilesToPackage data KeyboardLayouts
|
||||
: $(keyboardLayoutFiles) ;
|
||||
|
||||
# Add Apple Aluminum keyboard layout files to the image in an Apple Aluminum
|
||||
# subdirectory. The subdirectory is turned into a submenu in the Layout menu
|
||||
# of the Keymap preference app.
|
||||
local appleAluminumDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts
|
||||
Apple\ Aluminum ] ;
|
||||
local appleAluminumFiles =
|
||||
"Apple Aluminium Extended International"
|
||||
"Apple Aluminium International"
|
||||
"Apple Aluminum (US)"
|
||||
"Apple Aluminum Extended (US)" ;
|
||||
appleAluminumFiles = $(appleAluminumFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(appleAluminumFiles) = $(appleAluminumDir) ;
|
||||
: $(HAIKU_KEYBOARD_LAYOUT_FILES) ;
|
||||
AddFilesToPackage data KeyboardLayouts Apple\ Aluminum
|
||||
: $(appleAluminumFiles) ;
|
||||
|
||||
# Add ThinkPad keyboard layout files to the image in a ThinkPad
|
||||
# subdirectory. The subdirectory is turned into a submenu in the Layout menu
|
||||
# of the Keymap preference app.
|
||||
local thinkpadDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ThinkPad ] ;
|
||||
local thinkPadFiles =
|
||||
"ThinkPad (US)"
|
||||
"ThinkPad International"
|
||||
"ThinkPad T400s (US)"
|
||||
"ThinkPad T400s International"
|
||||
"ThinkPad X1 (US)"
|
||||
"ThinkPad X1 International"
|
||||
"ThinkPad X100e (US)"
|
||||
"ThinkPad X100e International" ;
|
||||
thinkPadFiles = $(thinkPadFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(thinkPadFiles) = $(thinkpadDir) ;
|
||||
: $(HAIKU_APPLE_ALUMINUM_KEYBOARD_LAYOUT_FILES) ;
|
||||
AddFilesToPackage data KeyboardLayouts ThinkPad
|
||||
: $(thinkPadFiles) ;
|
||||
: $(HAIKU_THINKPAD_KEYBOARD_LAYOUT_FILES) ;
|
||||
|
||||
# boot module links
|
||||
AddBootModuleSymlinksToPackage
|
||||
|
||||
@@ -2,6 +2,7 @@ SubDir HAIKU_TOP src data ;
|
||||
|
||||
HaikuSubInclude deskbar ;
|
||||
HaikuSubInclude etc ;
|
||||
HaikuSubInclude keyboard_layouts ;
|
||||
HaikuSubInclude keymaps ;
|
||||
HaikuSubInclude mime_db ;
|
||||
HaikuSubInclude settings ;
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
SubDir HAIKU_TOP src data keyboard_layouts ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
|
||||
rule GenerateKeyboardLayoutLocalizationHeader
|
||||
{
|
||||
local header = <keyboard-layout-locale>KeyboardLayoutNames.h ;
|
||||
MakeLocateCommonPlatform $(header) ;
|
||||
local jamfile = [ FGristFiles Jamfile ] ;
|
||||
SEARCH on $(jamfile) = $(SUBDIR) ;
|
||||
Depends $(header) : $(jamfile) ;
|
||||
GenerateKeyboardLayoutLocalizationHeader1 $(header) ;
|
||||
LocalClean clean : $(header) ;
|
||||
}
|
||||
|
||||
actions GenerateKeyboardLayoutLocalizationHeader1
|
||||
{
|
||||
$(RM) $(1)
|
||||
for name in "$(HAIKU_KEYBOARD_LAYOUT_FILES)" ; do
|
||||
echo "B_TRANSLATE_MARK_VOID(\"$name\")" >> $(1)
|
||||
done
|
||||
echo "B_TRANSLATE_MARK_VOID(\"Apple\ Aluminum\")" >> $(1)
|
||||
for name in "$(HAIKU_APPLE_ALUMINUM_KEYBOARD_LAYOUT_FILES)" ; do
|
||||
echo "B_TRANSLATE_MARK_VOID(\"$name\")" >> $(1)
|
||||
done
|
||||
echo "B_TRANSLATE_MARK_VOID(\"ThinkPad\")" >> $(1)
|
||||
for name in "$(HAIKU_THINKPAD_KEYBOARD_LAYOUT_FILES)" ; do
|
||||
echo "B_TRANSLATE_MARK_VOID(\"$name\")" >> $(1)
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Add keyboard layout files to the image.
|
||||
local keyboardLayoutsDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ] ;
|
||||
HAIKU_KEYBOARD_LAYOUT_FILES =
|
||||
"Generic 104-key"
|
||||
"Generic 105-key International"
|
||||
"Kinesis Advantage"
|
||||
"Kinesis Ergo Elan International"
|
||||
"TypeMatrix 2030" ;
|
||||
HAIKU_KEYBOARD_LAYOUT_FILES = $(HAIKU_KEYBOARD_LAYOUT_FILES:G=keyboard-layout) ;
|
||||
SEARCH on $(HAIKU_KEYBOARD_LAYOUT_FILES) = $(keyboardLayoutsDir) ;
|
||||
|
||||
# Add Apple Aluminum keyboard layout files to the image in an Apple Aluminum
|
||||
# subdirectory. The subdirectory is turned into a submenu in the Layout menu
|
||||
# of the Keymap preference app.
|
||||
local appleAluminumDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts
|
||||
Apple\ Aluminum ] ;
|
||||
HAIKU_APPLE_ALUMINUM_KEYBOARD_LAYOUT_FILES =
|
||||
"Apple Aluminium Extended International"
|
||||
"Apple Aluminium International"
|
||||
"Apple Aluminum (US)"
|
||||
"Apple Aluminum Extended (US)" ;
|
||||
HAIKU_APPLE_ALUMINUM_KEYBOARD_LAYOUT_FILES = $(HAIKU_APPLE_ALUMINUM_KEYBOARD_LAYOUT_FILES:G=keyboard-layout) ;
|
||||
SEARCH on $(HAIKU_APPLE_ALUMINUM_KEYBOARD_LAYOUT_FILES) = $(appleAluminumDir) ;
|
||||
|
||||
# Add ThinkPad keyboard layout files to the image in a ThinkPad
|
||||
# subdirectory. The subdirectory is turned into a submenu in the Layout menu
|
||||
# of the Keymap preference app.
|
||||
local thinkpadDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ThinkPad ] ;
|
||||
HAIKU_THINKPAD_KEYBOARD_LAYOUT_FILES =
|
||||
"ThinkPad (US)"
|
||||
"ThinkPad International"
|
||||
"ThinkPad T400s (US)"
|
||||
"ThinkPad T400s International"
|
||||
"ThinkPad X1 (US)"
|
||||
"ThinkPad X1 International"
|
||||
"ThinkPad X100e (US)"
|
||||
"ThinkPad X100e International" ;
|
||||
HAIKU_THINKPAD_KEYBOARD_LAYOUT_FILES
|
||||
= $(HAIKU_THINKPAD_KEYBOARD_LAYOUT_FILES:G=keyboard-layout) ;
|
||||
SEARCH on $(HAIKU_THINKPAD_KEYBOARD_LAYOUT_FILES) = $(thinkpadDir) ;
|
||||
|
||||
|
||||
GenerateKeyboardLayoutLocalizationHeader ;
|
||||
@@ -1,12 +1,16 @@
|
||||
SubDir HAIKU_TOP src preferences keymap ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) data keymaps ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) data
|
||||
keyboard_layouts ] ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
UsePrivateHeaders interface shared ;
|
||||
|
||||
Includes [ FGristFiles KeymapWindow.cpp ] : <keymap-locale>KeymapNames.h ;
|
||||
Includes [ FGristFiles KeymapWindow.cpp ]
|
||||
: <keyboard-layout-locale>KeyboardLayoutNames.h ;
|
||||
|
||||
Preference Keymap :
|
||||
KeyboardLayout.cpp
|
||||
|
||||
@@ -616,7 +616,8 @@ KeymapWindow::_AddKeyboardLayouts(BMenu* menu)
|
||||
if (find_directory(dataDirectories[i], &path) != B_OK)
|
||||
continue;
|
||||
|
||||
path.Append("KeyboardLayouts");
|
||||
if (path.Append("KeyboardLayouts") != B_OK)
|
||||
continue;
|
||||
|
||||
BDirectory directory;
|
||||
if (directory.SetTo(path.Path()) == B_OK)
|
||||
@@ -641,7 +642,7 @@ KeymapWindow::_AddKeyboardLayoutMenu(BMenu* menu, BDirectory directory)
|
||||
BDirectory subdirectory;
|
||||
subdirectory.SetTo(&ref);
|
||||
if (subdirectory.InitCheck() == B_OK) {
|
||||
BMenu* submenu = new BMenu(ref.name);
|
||||
BMenu* submenu = new BMenu(B_TRANSLATE_NOCOLLECT(ref.name));
|
||||
|
||||
_AddKeyboardLayoutMenu(submenu, subdirectory);
|
||||
menu->AddItem(submenu);
|
||||
@@ -649,7 +650,8 @@ KeymapWindow::_AddKeyboardLayoutMenu(BMenu* menu, BDirectory directory)
|
||||
BMessage* message = new BMessage(kChangeKeyboardLayout);
|
||||
|
||||
message->AddRef("ref", &ref);
|
||||
menu->AddItem(new BMenuItem(ref.name, message));
|
||||
menu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(ref.name),
|
||||
message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user