Ticket #6104: text_searchLocalization.patch
File text_searchLocalization.patch, 11.0 KB (added by , 14 years ago) |
---|
-
src/apps/text_search/Grepper.cpp
28 28 #include <stdlib.h> 29 29 #include <string.h> 30 30 31 #include <Catalog.h> 31 32 #include <Directory.h> 32 33 #include <List.h> 34 #include <Locale.h> 33 35 #include <NodeInfo.h> 34 36 #include <Path.h> 35 37 #include <UTF8.h> … … 37 39 #include "FileIterator.h" 38 40 #include "Model.h" 39 41 42 #undef B_TRANSLATE_CONTEXT 43 #define B_TRANSLATE_CONTEXT "Grepper" 44 45 40 46 using std::nothrow; 41 47 42 48 // TODO: stippi: Check if this is a the best place to maintain a global … … 203 209 } 204 210 205 211 if (!_EscapeSpecialChars(fileName, B_PATH_NAME_LENGTH)) { 206 sprintf(tempString, "%s: Not enough room to escape the filename.",207 fileName);212 sprintf(tempString, B_TRANSLATE("%s: Not enough room to escape " 213 "the filename."), fileName); 208 214 209 215 message.MakeEmpty(); 210 216 message.what = MSG_REPORT_ERROR; … … 240 246 } 241 247 } 242 248 243 sprintf(tempString, "%s: There was a problem running grep.", fileName);249 sprintf(tempString, B_TRANSLATE("%s: There was a problem running grep."), fileName); 244 250 245 251 message.MakeEmpty(); 246 252 message.what = MSG_REPORT_ERROR; -
src/apps/text_search/GrepWindow.cpp
46 46 #include "InitialIterator.h" 47 47 #include "Translation.h" 48 48 49 #undef B_TRANSLATE_CONTEXT 50 #define B_TRANSLATE_CONTEXT "GrepWindow" 51 52 49 53 using std::nothrow; 50 54 51 55 static const bigtime_t kChangesPulseInterval = 150000; … … 123 127 fChangesIterator(NULL), 124 128 fChangesPulse(NULL), 125 129 126 fFilePanel(NULL) 130 fFilePanel(NULL), 131 fAppCatalog(NULL) 127 132 { 128 133 if (fModel == NULL) 129 134 return; 130 135 136 be_locale->GetAppCatalog(&fAppCatalog); 137 131 138 entry_ref directory; 132 139 _InitRefsReceived(&directory, message); 133 140 … … 399 406 if (entry.InitCheck() == B_OK) { 400 407 BPath path; 401 408 if (entry.GetPath(&path) == B_OK) 402 title << APP_NAME << ": " << path.Path(); 409 if (strcmp(APP_NAME, "TextSearch") == 0) 410 title << B_TRANSLATE("TextSearch") << path.Path(); 411 else 412 title << APP_NAME << ": " << path.Path(); 403 413 } 404 414 405 415 if (!title.Length()) 406 title = APP_NAME; 416 if (strcmp(APP_NAME, "TextSearch") == 0) 417 title << B_TRANSLATE("TextSearch"); 418 else 419 title = APP_NAME; 407 420 408 421 SetTitle(title.String()); 409 422 } … … 414 427 { 415 428 fMenuBar = new BMenuBar(BRect(0,0,1,1), "menubar"); 416 429 417 fFileMenu = new BMenu( _T("File"));418 fActionMenu = new BMenu( _T("Actions"));419 fPreferencesMenu = new BMenu( _T("Settings"));420 fHistoryMenu = new BMenu( _T("History"));421 fEncodingMenu = new BMenu( _T("Encoding"));430 fFileMenu = new BMenu(B_TRANSLATE("File")); 431 fActionMenu = new BMenu(B_TRANSLATE("Actions")); 432 fPreferencesMenu = new BMenu(B_TRANSLATE("Settings")); 433 fHistoryMenu = new BMenu(B_TRANSLATE("History")); 434 fEncodingMenu = new BMenu(B_TRANSLATE("Encoding")); 422 435 423 436 fNew = new BMenuItem( 424 _T("New window"), new BMessage(MSG_NEW_WINDOW), 'N');437 B_TRANSLATE("New window"), new BMessage(MSG_NEW_WINDOW), 'N'); 425 438 426 439 fOpen = new BMenuItem( 427 _T("Set which files to search"), new BMessage(MSG_OPEN_PANEL), 'F');440 B_TRANSLATE("Set which files to search"), new BMessage(MSG_OPEN_PANEL), 'F'); 428 441 429 442 fClose = new BMenuItem( 430 _T("Close"), new BMessage(B_QUIT_REQUESTED), 'W');443 B_TRANSLATE("Close"), new BMessage(B_QUIT_REQUESTED), 'W'); 431 444 432 445 fAbout = new BMenuItem( 433 _T("About TextSearch" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED));446 B_TRANSLATE("About TextSearch" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED)); 434 447 435 448 fQuit = new BMenuItem( 436 _T("Quit"), new BMessage(MSG_QUIT_NOW), 'Q');449 B_TRANSLATE("Quit"), new BMessage(MSG_QUIT_NOW), 'Q'); 437 450 438 451 fSearch = new BMenuItem( 439 _T("Search"), new BMessage(MSG_START_CANCEL), 'S');452 B_TRANSLATE("Search"), new BMessage(MSG_START_CANCEL), 'S'); 440 453 441 454 fSelectAll = new BMenuItem( 442 _T("Select all"), new BMessage(MSG_SELECT_ALL), 'A');455 B_TRANSLATE("Select all"), new BMessage(MSG_SELECT_ALL), 'A'); 443 456 444 457 fTrimSelection = new BMenuItem( 445 _T("Trim to selection"), new BMessage(MSG_TRIM_SELECTION), 'T');458 B_TRANSLATE("Trim to selection"), new BMessage(MSG_TRIM_SELECTION), 'T'); 446 459 447 460 fOpenSelection = new BMenuItem( 448 _T("Open selection"), new BMessage(MSG_OPEN_SELECTION), 'O');461 B_TRANSLATE("Open selection"), new BMessage(MSG_OPEN_SELECTION), 'O'); 449 462 450 463 fSelectInTracker = new BMenuItem( 451 _T("Show files in Tracker"), new BMessage(MSG_SELECT_IN_TRACKER), 'K');464 B_TRANSLATE("Show files in Tracker"), new BMessage(MSG_SELECT_IN_TRACKER), 'K'); 452 465 453 466 fCopyText = new BMenuItem( 454 _T("Copy text to clipboard"), new BMessage(MSG_COPY_TEXT), 'B');467 B_TRANSLATE("Copy text to clipboard"), new BMessage(MSG_COPY_TEXT), 'B'); 455 468 456 469 fRecurseLinks = new BMenuItem( 457 _T("Follow symbolic links"), new BMessage(MSG_RECURSE_LINKS));470 B_TRANSLATE("Follow symbolic links"), new BMessage(MSG_RECURSE_LINKS)); 458 471 459 472 fRecurseDirs = new BMenuItem( 460 _T("Look in sub-folders"), new BMessage(MSG_RECURSE_DIRS));473 B_TRANSLATE("Look in sub-folders"), new BMessage(MSG_RECURSE_DIRS)); 461 474 462 475 fSkipDotDirs = new BMenuItem( 463 _T("Skip sub-folders starting with a dot"), new BMessage(MSG_SKIP_DOT_DIRS));476 B_TRANSLATE("Skip sub-folders starting with a dot"), new BMessage(MSG_SKIP_DOT_DIRS)); 464 477 465 478 fCaseSensitive = new BMenuItem( 466 _T("Case-sensitive"), new BMessage(MSG_CASE_SENSITIVE));479 B_TRANSLATE("Case-sensitive"), new BMessage(MSG_CASE_SENSITIVE)); 467 480 468 481 fEscapeText = new BMenuItem( 469 _T("Escape search text"), new BMessage(MSG_ESCAPE_TEXT));482 B_TRANSLATE("Escape search text"), new BMessage(MSG_ESCAPE_TEXT)); 470 483 471 484 fTextOnly = new BMenuItem( 472 _T("Text files only"), new BMessage(MSG_TEXT_ONLY));485 B_TRANSLATE("Text files only"), new BMessage(MSG_TEXT_ONLY)); 473 486 474 487 fInvokePe = new BMenuItem( 475 _T("Open files in Pe"), new BMessage(MSG_INVOKE_PE));488 B_TRANSLATE("Open files in Pe"), new BMessage(MSG_INVOKE_PE)); 476 489 477 490 fShowLinesMenuitem = new BMenuItem( 478 _T("Show lines"), new BMessage(MSG_MENU_SHOW_LINES), 'L');491 B_TRANSLATE("Show lines"), new BMessage(MSG_MENU_SHOW_LINES), 'L'); 479 492 fShowLinesMenuitem->SetMarked(true); 480 493 481 494 fUTF8 = new BMenuItem("UTF8", new BMessage('utf8')); … … 553 566 fSearchText->SetModificationMessage(new BMessage(MSG_SEARCH_TEXT)); 554 567 555 568 fButton = new BButton( 556 BRect(0, 1, 80, 1), "Button", _T("Search"),569 BRect(0, 1, 80, 1), "Button", B_TRANSLATE("Search"), 557 570 new BMessage(MSG_START_CANCEL), B_FOLLOW_RIGHT); 558 571 559 572 fButton->MakeDefault(true); … … 561 574 fButton->SetEnabled(false); 562 575 563 576 fShowLinesCheckbox = new BCheckBox( 564 BRect(0, 0, 1, 1), "ShowLines", _T("Show lines"),577 BRect(0, 0, 1, 1), "ShowLines", B_TRANSLATE("Show lines"), 565 578 new BMessage(MSG_CHECKBOX_SHOW_LINES), B_FOLLOW_LEFT); 566 579 567 580 fShowLinesCheckbox->SetValue(B_CONTROL_ON); … … 792 805 fSearchText->SetEnabled(false); 793 806 794 807 fButton->MakeFocus(true); 795 fButton->SetLabel( _T("Cancel"));808 fButton->SetLabel(B_TRANSLATE("Cancel")); 796 809 fSearch->SetEnabled(false); 797 810 798 811 // We need to remember the search pattern, because during … … 842 855 fHistoryMenu->SetEnabled(true); 843 856 fEncodingMenu->SetEnabled(true); 844 857 845 fButton->SetLabel( _T("Search"));858 fButton->SetLabel(B_TRANSLATE("Search")); 846 859 fButton->SetEnabled(true); 847 860 fSearch->SetEnabled(true); 848 861 … … 1280 1293 { 1281 1294 if (fSearchResults->CurrentSelection() < 0) { 1282 1295 BString text; 1283 text << _T("Please select the files you wish to keep searching.");1296 text << B_TRANSLATE("Please select the files you wish to keep searching."); 1284 1297 text << "\n"; 1285 text << _T("The unselected files will be removed from the list.");1298 text << B_TRANSLATE("The unselected files will be removed from the list."); 1286 1299 text << "\n"; 1287 BAlert* alert = new BAlert(NULL, text.String(), _T("OK"), NULL, NULL,1300 BAlert* alert = new BAlert(NULL, text.String(), B_TRANSLATE("OK"), NULL, NULL, 1288 1301 B_WIDTH_AS_USUAL, B_WARNING_ALERT); 1289 1302 alert->Go(NULL); 1290 1303 return; … … 1375 1388 { 1376 1389 if (fSearchResults->CurrentSelection() < 0) { 1377 1390 BAlert* alert = new BAlert("Info", 1378 _T("Please select the files you wish to have selected for you in "1391 B_TRANSLATE("Please select the files you wish to have selected for you in " 1379 1392 "Tracker."), 1380 _T("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);1393 B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); 1381 1394 alert->Go(NULL); 1382 1395 return; 1383 1396 } … … 1437 1450 } 1438 1451 1439 1452 if (!_AreAllFoldersOpenInTracker(&folderList)) { 1440 BAlert* alert = new BAlert(NULL, 1441 _T(APP_NAME " couldn't open one or more folders,"), 1442 _T("OK"), NULL, NULL, B_WIDTH_AS_USUAL, 1443 B_STOP_ALERT); 1453 BString str1; 1454 if (strcmp(APP_NAME, "TextSearch") == 0) 1455 str1 << B_TRANSLATE("TextSearch couldn't open one or more folders."); 1456 else 1457 str1 << APP_NAME << " couldn't open one or more folders."; 1458 BAlert* alert = new BAlert(NULL, str1.String(), B_TRANSLATE("OK"), 1459 NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); 1444 1460 alert->Go(NULL); 1445 1461 goto out; 1446 1462 } … … 1469 1485 GrepWindow::_OnAboutRequested() 1470 1486 { 1471 1487 BString text; 1472 text << APP_NAME << " " << "\n\n"; 1488 if (strcmp(APP_NAME, "TextSearch") == 0) 1489 text << B_TRANSLATE("TextSearch") << "\n\n"; 1490 else 1491 text << APP_NAME << " " << "\n\n"; 1473 1492 int32 titleLength = text.Length(); 1474 text << _T("Created by Matthijs Hollemans.") << "\n\n"; 1475 text << _T("Contributed to by "); 1476 text << _T("Peter Hinely, Serge Fantino, Hideki Naito, Oscar Lesta, " 1477 "Oliver Tappe, Jonas Sundström, Luc Schrijvers and momoziro."); 1478 text << "\n"; 1493 text << B_TRANSLATE("Created by Matthijs Hollemans.") << "\n\n"; 1494 text << B_TRANSLATE("Contributed to by "); 1495 text << "Peter Hinely, Serge Fantino, Hideki Naito, Oscar Lesta, " 1496 "Oliver Tappe, Jonas Sundström, Luc Schrijvers "; 1497 text << B_TRANSLATE("and"); 1498 text << " momoziro.\n"; 1479 1499 1480 BAlert* alert = new BAlert("TextSearch", text.String(), _T("OK"), NULL,1500 BAlert* alert = new BAlert("TextSearch", text.String(), B_TRANSLATE("OK"), NULL, 1481 1501 NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT); 1482 1502 1483 1503 BTextView* view = alert->TextView(); -
src/apps/text_search/Jamfile
24 24 25 25 $(additionalBeOSSources) 26 26 27 : be tracker textencoding libshared.a $(TARGET_LIBSUPC++)27 : be locale tracker textencoding libshared.a $(TARGET_LIBSUPC++) 28 28 : TextSearch.rdef 29 29 ; 30 31 DoCatalogs TextSearch : 32 x-vnd.Haiku.TextSearch 33 : 34 GrepWindow.cpp 35 Grepper.cpp 36 ; -
src/apps/text_search/GrepWindow.h
22 22 #ifndef GREP_WINDOW_H 23 23 #define GREP_WINDOW_H 24 24 25 #include <Catalog.h> 25 26 #include <InterfaceKit.h> 26 27 #include <FilePanel.h> 28 #include <Locale.h> 27 29 28 30 #include "Model.h" 29 31 #include "GrepListView.h" … … 143 145 BMessageRunner* fChangesPulse; 144 146 145 147 BFilePanel* fFilePanel; 148 BCatalog fAppCatalog; 146 149 }; 147 150 148 151 #endif // GREP_WINDOW_H