Ticket #5857: ShortcutsLocalization.patch

File ShortcutsLocalization.patch, 10.7 KB (added by Karvjorm, 12 years ago)

A localization patch for Shortcuts preflet.

  • src/preferences/shortcuts/ShortcutsApp.cpp

     
    1111#include "ShortcutsApp.h"
    1212
    1313#include <Alert.h>
     14#include <Catalog.h>
     15#include <Locale.h>
    1416
    1517#include "ShortcutsWindow.h"
    1618
    1719
    1820#define APPLICATION_SIGNATURE "application/x-vnd.Haiku-Shortcuts"
    1921
     22#undef TR_CONTEXT
     23#define TR_CONTEXT "ShortcutsApp"
    2024
    2125ShortcutsApp::ShortcutsApp()
    2226    :
     
    4145void
    4246ShortcutsApp::AboutRequested()
    4347{
    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"));
    4751    alert->Go();
    4852}
    4953
  • src/preferences/shortcuts/main.cpp

     
    1010#include "KeyInfos.h"
    1111#include "ShortcutsApp.h"
    1212
     13#include <Catalog.h>
     14#include <Locale.h>
    1315
    1416int main(int argc, char** argv)
    1517{
    1618    InitKeyIndices();
    1719    ShortcutsApp app;
     20   
     21    BCatalog cat;
     22    be_locale->GetAppCatalog(&cat);
     23   
    1824    app.Run();
    1925}
    2026
  • src/preferences/shortcuts/ShortcutsWindow.cpp

     
    1515
    1616#include <Alert.h>
    1717#include <Application.h>
     18#include <Catalog.h>
    1819#include <Clipboard.h>
    1920#include <File.h>
    2021#include <FindDirectory.h>
    2122#include <Input.h>
     23#include <Locale.h>
    2224#include <Menu.h>
    2325#include <MenuBar.h>
    2426#include <MenuItem.h>
     
    4850#define WINDOW_START_X 30
    4951#define WINDOW_START_Y 100
    5052
     53#undef TR_CONTEXT
     54#define TR_CONTEXT "ShortcutsWindow"
     55
    5156#define ERROR "Shortcuts error"
    5257#define WARNING "Shortcuts warning"
    5358
     
    9095ShortcutsWindow::ShortcutsWindow()
    9196    :
    9297    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),
    9499        fSavePanel(NULL),
    95100        fOpenPanel(NULL),
    96101        fSelectPanel(NULL),
     
    99104{
    100105    InitializeMetaMaps();
    101106    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"));
    103108
    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..."),
    106111        new BMessage(OPEN_KEYSET), 'O'));
    107     fileMenu->AddItem(new BMenuItem("Append KeySet...",
     112    fileMenu->AddItem(new BMenuItem(TR("Append KeySet..."),
    108113        new BMessage(APPEND_KEYSET), 'A'));
    109     fileMenu->AddItem(new BMenuItem("Revert to saved",
     114    fileMenu->AddItem(new BMenuItem(TR("Revert to saved"),
    110115        new BMessage(REVERT_KEYSET), 'A'));
    111116    fileMenu->AddItem(new BSeparatorItem);
    112     fileMenu->AddItem(new BMenuItem("Save KeySet as...",
     117    fileMenu->AddItem(new BMenuItem(TR("Save KeySet as..."),
    113118        new BMessage(SAVE_KEYSET_AS), 'S'));
    114119    fileMenu->AddItem(new BSeparatorItem);
    115     fileMenu->AddItem(new BMenuItem("About Shortcuts",
     120    fileMenu->AddItem(new BMenuItem(TR("About Shortcuts"),
    116121        new BMessage(B_ABOUT_REQUESTED)));
    117122    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),
    119124        'Q'));
    120125    menuBar->AddItem(fileMenu);
    121126
     
    146151            new CLVColumn(ShortcutsSpec::GetColumnName(i), CreateMetaPopUp(i),
    147152            metaWidth, CLV_SORT_KEYABLE));
    148153
    149     fColumnListView->AddColumn(new CLVColumn("Key", CreateKeysPopUp(), 60,
     154    fColumnListView->AddColumn(new CLVColumn(TR("Key"), CreateKeysPopUp(), 60,
    150155        CLV_SORT_KEYABLE));
    151156
    152157    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));
    159164    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));
    163168    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,
    167172        CLV_SORT_KEYABLE));
    168173
    169174    fColumnListView->SetSortFunction(ShortcutsSpec::MyCompare);
     
    183188    buttonBounds.right = (buttonBounds.left + origRight) * 0.40f -
    184189        (V_SPACING / 2);
    185190    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)));
    187192    buttonBounds.left = buttonBounds.right + V_SPACING;
    188193    buttonBounds.right = origRight;
    189194    AddChild(fRemoveButton = new ResizableButton(Bounds(), buttonBounds,
    190         "remove", "Remove selected shortcut",
     195        "remove", TR("Remove selected shortcut"),
    191196        new BMessage(REMOVE_HOTKEY_ITEM)));
    192197   
    193198    fRemoveButton->SetEnabled(false);
     
    197202    saveButtonBounds.right = Bounds().right - B_V_SCROLL_BAR_WIDTH - offset;
    198203    saveButtonBounds.left = buttonBounds.right + V_SPACING + offset;
    199204    AddChild(fSaveButton = new ResizableButton(Bounds(), saveButtonBounds,
    200         "save", "Save & apply", new BMessage(SAVE_KEYSET)));
     205        "save", TR("Save & apply"), new BMessage(SAVE_KEYSET)));
    201206   
    202207    fSaveButton->SetEnabled(false);
    203208
     
    228233
    229234    if (fKeySetModified) {
    230235        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"));
    233238        switch(alert->Go()) {
    234239            case 1:
    235240                ret = false;
     
    241246                if (fLastSaved.InitCheck() == B_NO_ERROR) {
    242247                    if (_SaveKeySet(fLastSaved) == false) {
    243248                        (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();
    246251                        ret = true; //quit anyway
    247252                    }
    248253                } else {
     
    293298            == B_NO_ERROR)
    294299            saveMsg.AddMessage("spec", &next);
    295300        else
    296             printf("Error archiving ShortcutsSpec #%i!\n",i);
     301            printf(TR("Error archiving ShortcutsSpec #%i!\n"),i);
    297302    }
    298303   
    299304    bool ret = (saveMsg.Flatten(&saveTo) == B_NO_ERROR);
     
    319324        if (spec != NULL)
    320325            fColumnListView->AddItem(spec);
    321326        else
    322             printf("_LoadKeySet: Error parsing spec!\n");
     327            printf(TR("_LoadKeySet: Error parsing spec!\n"));
    323328    }
    324329    return true;
    325330}
     
    364369                fOpenPanel->Show();
    365370            }
    366371            fOpenPanel->SetButtonLabel(B_DEFAULT_BUTTON, fLastOpenWasAppend ?
    367                 "Append" : "Open");
     372                TR("Append") : TR("Open"));
    368373        break;
    369374
    370375        case REVERT_KEYSET:
     
    421426                            break;
    422427                        } else {
    423428                            (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);
    426431                            break;
    427432                        }
    428433                    }
     
    448453                    if (ref == eref) fKeySetModified = false;
    449454                } else {
    450455                    (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);
    453458                    break;
    454459                }
    455460            }
     
    499504            } else PostMessage(SAVE_KEYSET_AS); // open the save requester...
    500505
    501506            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);
    504510            }
    505511        }
    506512        break;
  • src/preferences/shortcuts/ShortcutsSpec.cpp

     
    1313#include <stdio.h>
    1414
    1515#include <Beep.h>
     16#include <Catalog.h>
    1617#include <Directory.h>
     18#include <Locale.h>
    1719#include <NodeInfo.h>
    1820#include <Path.h>
    1921#include <Region.h>
     
    3032
    3133#define CLASS "ShortcutsSpec : "
    3234
     35#undef TR_CONTEXT
     36#define TR_CONTEXT "ShortcutsSpec"
    3337
    3438const float _height = 20.0f;       
    3539
     
    203207{
    204208    const char* temp;   
    205209    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"));
    207212        temp = "";
    208213    }
    209214
    210215    SetCommand(temp);
    211216
    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    }
    214221
    215222    for (int i = 0; i < NUM_META_COLUMNS; i++)
    216223        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        }
    219228}
    220229
    221230
     
    760769                                    break;
    761770                                }
    762771                            } else
    763                                 printf("Error, NULL state description?\n");
     772                                printf(TR("Error, NULL state description?\n"));
    764773                        }
    765774                    }
    766775                    break;