Ticket #5857: ShortcutsLocalization.patch
File ShortcutsLocalization.patch, 10.7 KB (added by , 14 years ago) |
---|
-
src/preferences/shortcuts/ShortcutsApp.cpp
11 11 #include "ShortcutsApp.h" 12 12 13 13 #include <Alert.h> 14 #include <Catalog.h> 15 #include <Locale.h> 14 16 15 17 #include "ShortcutsWindow.h" 16 18 17 19 18 20 #define APPLICATION_SIGNATURE "application/x-vnd.Haiku-Shortcuts" 19 21 22 #undef TR_CONTEXT 23 #define TR_CONTEXT "ShortcutsApp" 20 24 21 25 ShortcutsApp::ShortcutsApp() 22 26 : … … 41 45 void 42 46 ShortcutsApp::AboutRequested() 43 47 { 44 BAlert* alert = new BAlert( "About Shortcuts",45 "Shortcuts\n\n"46 "Based on SpicyKeys for BeOS made by Jeremy Friesner." , "OK");48 BAlert* alert = new BAlert(TR("About Shortcuts"), 49 TR("Shortcuts\n\n" 50 "Based on SpicyKeys for BeOS made by Jeremy Friesner."), TR("OK")); 47 51 alert->Go(); 48 52 } 49 53 -
src/preferences/shortcuts/main.cpp
10 10 #include "KeyInfos.h" 11 11 #include "ShortcutsApp.h" 12 12 13 #include <Catalog.h> 14 #include <Locale.h> 13 15 14 16 int main(int argc, char** argv) 15 17 { 16 18 InitKeyIndices(); 17 19 ShortcutsApp app; 20 21 BCatalog cat; 22 be_locale->GetAppCatalog(&cat); 23 18 24 app.Run(); 19 25 } 20 26 -
src/preferences/shortcuts/ShortcutsWindow.cpp
15 15 16 16 #include <Alert.h> 17 17 #include <Application.h> 18 #include <Catalog.h> 18 19 #include <Clipboard.h> 19 20 #include <File.h> 20 21 #include <FindDirectory.h> 21 22 #include <Input.h> 23 #include <Locale.h> 22 24 #include <Menu.h> 23 25 #include <MenuBar.h> 24 26 #include <MenuItem.h> … … 48 50 #define WINDOW_START_X 30 49 51 #define WINDOW_START_Y 100 50 52 53 #undef TR_CONTEXT 54 #define TR_CONTEXT "ShortcutsWindow" 55 51 56 #define ERROR "Shortcuts error" 52 57 #define WARNING "Shortcuts warning" 53 58 … … 90 95 ShortcutsWindow::ShortcutsWindow() 91 96 : 92 97 BWindow(BRect(WINDOW_START_X, WINDOW_START_Y, WINDOW_START_X + MIN_WIDTH, 93 WINDOW_START_Y + MIN_HEIGHT * 2), "Shortcuts", B_DOCUMENT_WINDOW, 0L),98 WINDOW_START_Y + MIN_HEIGHT * 2), TR("Shortcuts"), B_DOCUMENT_WINDOW, 0L), 94 99 fSavePanel(NULL), 95 100 fOpenPanel(NULL), 96 101 fSelectPanel(NULL), … … 99 104 { 100 105 InitializeMetaMaps(); 101 106 SetSizeLimits(MIN_WIDTH, MAX_WIDTH, MIN_HEIGHT, MAX_HEIGHT); 102 BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "Menu Bar");107 BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), TR("Menu Bar")); 103 108 104 BMenu* fileMenu = new BMenu( "File");105 fileMenu->AddItem(new BMenuItem( "Open KeySet...",109 BMenu* fileMenu = new BMenu(TR("File")); 110 fileMenu->AddItem(new BMenuItem(TR("Open KeySet..."), 106 111 new BMessage(OPEN_KEYSET), 'O')); 107 fileMenu->AddItem(new BMenuItem( "Append KeySet...",112 fileMenu->AddItem(new BMenuItem(TR("Append KeySet..."), 108 113 new BMessage(APPEND_KEYSET), 'A')); 109 fileMenu->AddItem(new BMenuItem( "Revert to saved",114 fileMenu->AddItem(new BMenuItem(TR("Revert to saved"), 110 115 new BMessage(REVERT_KEYSET), 'A')); 111 116 fileMenu->AddItem(new BSeparatorItem); 112 fileMenu->AddItem(new BMenuItem( "Save KeySet as...",117 fileMenu->AddItem(new BMenuItem(TR("Save KeySet as..."), 113 118 new BMessage(SAVE_KEYSET_AS), 'S')); 114 119 fileMenu->AddItem(new BSeparatorItem); 115 fileMenu->AddItem(new BMenuItem( "About Shortcuts",120 fileMenu->AddItem(new BMenuItem(TR("About Shortcuts"), 116 121 new BMessage(B_ABOUT_REQUESTED))); 117 122 fileMenu->AddItem(new BSeparatorItem); 118 fileMenu->AddItem(new BMenuItem( "Quit", new BMessage(B_QUIT_REQUESTED),123 fileMenu->AddItem(new BMenuItem(TR("Quit"), new BMessage(B_QUIT_REQUESTED), 119 124 'Q')); 120 125 menuBar->AddItem(fileMenu); 121 126 … … 146 151 new CLVColumn(ShortcutsSpec::GetColumnName(i), CreateMetaPopUp(i), 147 152 metaWidth, CLV_SORT_KEYABLE)); 148 153 149 fColumnListView->AddColumn(new CLVColumn( "Key", CreateKeysPopUp(), 60,154 fColumnListView->AddColumn(new CLVColumn(TR("Key"), CreateKeysPopUp(), 60, 150 155 CLV_SORT_KEYABLE)); 151 156 152 157 BPopUpMenu* popup = new BPopUpMenu(NULL, false); 153 popup->AddItem(new BMenuItem( "(Choose application with file requester)", NULL));154 popup->AddItem(new BMenuItem( "*InsertString \"Your Text Here\"", NULL));155 popup->AddItem(new BMenuItem( "*MoveMouse +20 +0", NULL));156 popup->AddItem(new BMenuItem( "*MoveMouseTo 50% 50%", NULL));157 popup->AddItem(new BMenuItem( "*MouseButton 1", NULL));158 popup->AddItem(new BMenuItem( "*LaunchHandler text/html", NULL));158 popup->AddItem(new BMenuItem(TR("(Choose application with file requester)"), NULL)); 159 popup->AddItem(new BMenuItem(TR("*InsertString \"Your Text Here\""), NULL)); 160 popup->AddItem(new BMenuItem(TR("*MoveMouse +20 +0"), NULL)); 161 popup->AddItem(new BMenuItem(TR("*MoveMouseTo 50% 50%"), NULL)); 162 popup->AddItem(new BMenuItem(TR("*MouseButton 1"), NULL)); 163 popup->AddItem(new BMenuItem(TR("*LaunchHandler text/html"), NULL)); 159 164 popup->AddItem(new BMenuItem( 160 "*Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\"", NULL));161 popup->AddItem(new BMenuItem( "*MouseDown", NULL));162 popup->AddItem(new BMenuItem( "*MouseUp", NULL));165 TR("*Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\""), NULL)); 166 popup->AddItem(new BMenuItem(TR("*MouseDown"), NULL)); 167 popup->AddItem(new BMenuItem(TR("*MouseUp"), NULL)); 163 168 popup->AddItem(new BMenuItem( 164 "*SendMessage application/x-vnd.Be-TRAK 'Tfnd'", NULL));165 popup->AddItem(new BMenuItem( "*Beep", NULL));166 fColumnListView->AddColumn(new CLVColumn( "Application", popup, 323.0,169 TR("*SendMessage application/x-vnd.Be-TRAK 'Tfnd'"), NULL)); 170 popup->AddItem(new BMenuItem(TR("*Beep"), NULL)); 171 fColumnListView->AddColumn(new CLVColumn(TR("Application"), popup, 323.0, 167 172 CLV_SORT_KEYABLE)); 168 173 169 174 fColumnListView->SetSortFunction(ShortcutsSpec::MyCompare); … … 183 188 buttonBounds.right = (buttonBounds.left + origRight) * 0.40f - 184 189 (V_SPACING / 2); 185 190 AddChild(fAddButton = new ResizableButton(Bounds(), buttonBounds, "add", 186 "Add new shortcut", new BMessage(ADD_HOTKEY_ITEM)));191 TR("Add new shortcut"), new BMessage(ADD_HOTKEY_ITEM))); 187 192 buttonBounds.left = buttonBounds.right + V_SPACING; 188 193 buttonBounds.right = origRight; 189 194 AddChild(fRemoveButton = new ResizableButton(Bounds(), buttonBounds, 190 "remove", "Remove selected shortcut",195 "remove", TR("Remove selected shortcut"), 191 196 new BMessage(REMOVE_HOTKEY_ITEM))); 192 197 193 198 fRemoveButton->SetEnabled(false); … … 197 202 saveButtonBounds.right = Bounds().right - B_V_SCROLL_BAR_WIDTH - offset; 198 203 saveButtonBounds.left = buttonBounds.right + V_SPACING + offset; 199 204 AddChild(fSaveButton = new ResizableButton(Bounds(), saveButtonBounds, 200 "save", "Save & apply", new BMessage(SAVE_KEYSET)));205 "save", TR("Save & apply"), new BMessage(SAVE_KEYSET))); 201 206 202 207 fSaveButton->SetEnabled(false); 203 208 … … 228 233 229 234 if (fKeySetModified) { 230 235 BAlert* alert = new BAlert(WARNING, 231 "Really quit without saving your changes?", "Don't save", "Cancel",232 "Save");236 TR("Really quit without saving your changes?"), TR("Don't save"), 237 TR("Cancel"), TR("Save")); 233 238 switch(alert->Go()) { 234 239 case 1: 235 240 ret = false; … … 241 246 if (fLastSaved.InitCheck() == B_NO_ERROR) { 242 247 if (_SaveKeySet(fLastSaved) == false) { 243 248 (new BAlert(ERROR, 244 "Shortcuts was unable to save your KeySet file!",245 "Oh no"))->Go();249 TR("Shortcuts was unable to save your KeySet file!"), 250 TR("Oh no")))->Go(); 246 251 ret = true; //quit anyway 247 252 } 248 253 } else { … … 293 298 == B_NO_ERROR) 294 299 saveMsg.AddMessage("spec", &next); 295 300 else 296 printf( "Error archiving ShortcutsSpec #%i!\n",i);301 printf(TR("Error archiving ShortcutsSpec #%i!\n"),i); 297 302 } 298 303 299 304 bool ret = (saveMsg.Flatten(&saveTo) == B_NO_ERROR); … … 319 324 if (spec != NULL) 320 325 fColumnListView->AddItem(spec); 321 326 else 322 printf( "_LoadKeySet: Error parsing spec!\n");327 printf(TR("_LoadKeySet: Error parsing spec!\n")); 323 328 } 324 329 return true; 325 330 } … … 364 369 fOpenPanel->Show(); 365 370 } 366 371 fOpenPanel->SetButtonLabel(B_DEFAULT_BUTTON, fLastOpenWasAppend ? 367 "Append" : "Open");372 TR("Append") : TR("Open")); 368 373 break; 369 374 370 375 case REVERT_KEYSET: … … 421 426 break; 422 427 } else { 423 428 (new BAlert(ERROR, 424 "Shortcuts was couldn't open your KeySet file!"425 , "Okay"))->Go(NULL);429 TR("Shortcuts was couldn't open your KeySet " 430 "file!"), TR("Okay")))->Go(NULL); 426 431 break; 427 432 } 428 433 } … … 448 453 if (ref == eref) fKeySetModified = false; 449 454 } else { 450 455 (new BAlert(ERROR, 451 "Shortcuts was unable to parse your KeySet file!",452 "Okay"))->Go(NULL);456 TR("Shortcuts was unable to parse your KeySet file!"), 457 TR("Okay")))->Go(NULL); 453 458 break; 454 459 } 455 460 } … … 499 504 } else PostMessage(SAVE_KEYSET_AS); // open the save requester... 500 505 501 506 if (showSaveError) { 502 (new BAlert(ERROR, "Shortcuts wasn't able to save your keyset." 503 , "Okay"))->Go(NULL); 507 (new BAlert(ERROR, 508 TR("Shortcuts wasn't able to save your keyset."), 509 TR("Okay")))->Go(NULL); 504 510 } 505 511 } 506 512 break; -
src/preferences/shortcuts/ShortcutsSpec.cpp
13 13 #include <stdio.h> 14 14 15 15 #include <Beep.h> 16 #include <Catalog.h> 16 17 #include <Directory.h> 18 #include <Locale.h> 17 19 #include <NodeInfo.h> 18 20 #include <Path.h> 19 21 #include <Region.h> … … 30 32 31 33 #define CLASS "ShortcutsSpec : " 32 34 35 #undef TR_CONTEXT 36 #define TR_CONTEXT "ShortcutsSpec" 33 37 34 38 const float _height = 20.0f; 35 39 … … 203 207 { 204 208 const char* temp; 205 209 if (from->FindString("command", &temp) != B_NO_ERROR) { 206 printf(CLASS " Error, no command string in archive BMessage!\n"); 210 printf(CLASS); 211 printf(TR(" Error, no command string in archive BMessage!\n")); 207 212 temp = ""; 208 213 } 209 214 210 215 SetCommand(temp); 211 216 212 if (from->FindInt32("key", (int32*) &fKey) != B_NO_ERROR) 213 printf(CLASS " Error, no key int32 in archive BMessage!\n"); 217 if (from->FindInt32("key", (int32*) &fKey) != B_NO_ERROR) { 218 printf(CLASS); 219 printf(TR(" Error, no key int32 in archive BMessage!\n")); 220 } 214 221 215 222 for (int i = 0; i < NUM_META_COLUMNS; i++) 216 223 if (from->FindInt32("mcidx", i, (int32*)&fMetaCellStateIndex[i]) 217 != B_NO_ERROR) 218 printf(CLASS " Error, no modifiers int32 in archive BMessage!\n"); 224 != B_NO_ERROR) { 225 printf(CLASS); 226 printf(TR(" Error, no modifiers int32 in archive BMessage!\n")); 227 } 219 228 } 220 229 221 230 … … 760 769 break; 761 770 } 762 771 } else 763 printf( "Error, NULL state description?\n");772 printf(TR("Error, NULL state description?\n")); 764 773 } 765 774 } 766 775 break;