Ticket #7169: diskusage-localization.patch

File diskusage-localization.patch, 5.3 KB (added by Karvjorm, 14 years ago)

A DiskUsage localization patch

  • src/apps/diskusage/MainWindow.cpp

     
    1010#include "MainWindow.h"
    1111
    1212#include <Application.h>
     13#include <Catalog.h>
    1314#include <Node.h>
    1415#include <Roster.h>
    1516#include <Screen.h>
     
    1920#include "Common.h"
    2021#include "ControlsView.h"
    2122
     23#undef B_TRANSLATE_CONTEXT
     24#define B_TRANSLATE_CONTEXT "MainWindow"
    2225
    2326MainWindow::MainWindow(BRect pieRect)
    2427    :
    25     BWindow(pieRect, "DiskUsage", B_TITLED_WINDOW,
     28    BWindow(pieRect, B_TRANSLATE("DiskUsage"), B_TITLED_WINDOW,
    2629        B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE
    2730        | B_AUTO_UPDATE_SIZE_LIMITS)
    2831{
  • src/apps/diskusage/Jamfile

     
    1515    Snapshot.cpp
    1616    StatusView.cpp
    1717    VolumeView.cpp
    18     : be $(TARGET_LIBSTDC++)
     18    : be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSTDC++)
    1919    : DiskUsage.rdef
    2020;
    2121
     22DoCatalogs DiskUsage :
     23    x-vnd.Haiku-DiskUsage
     24    :
     25    MainWindow.cpp
     26    Common.cpp
     27;
     28
  • src/apps/diskusage/Common.cpp

     
    1717#include <stdlib.h>
    1818
    1919#include <Application.h>
     20#include <Catalog.h>
    2021#include <FindDirectory.h>
    2122#include <Roster.h>
    2223#include <Path.h>
    2324
    2425
     26#undef B_TRANSLATE_CONTEXT
     27#define B_TRANSLATE_CONTEXT "Common"
     28
    2529const char* kAppSignature       = "application/x-vnd.Haiku-DiskUsage";
    2630const char* kHelpFileName       = "userguide/en/applications/diskusage.html";
    2731const char* kPieRectAttrName    = "mainrect";
     
    7680
    7781    size_t ignore;
    7882    kVolMenuLabel = LoadString("STR_VM_LABEL");
     83    if (strncmp(kVolMenuLabel, "Volume:", sizeof("Volume:")) == 0)
     84        kVolMenuLabel = (char *)B_TRANSLATE("Volume:");
     85
    7986    kOneFile = LoadString("STR_1_FILE");
     87    if (strncmp(kOneFile, "%d file", sizeof("%d file")) == 0)
     88        kOneFile = (char *)B_TRANSLATE("%d file");
     89
    8090    kManyFiles = LoadString("STR_N_FILES");
     91    if (strncmp(kManyFiles, "%d files", sizeof("%d files")) == 0)
     92        kManyFiles = (char *)B_TRANSLATE("%d files");
     93
    8194    kStrScan = LoadString("STR_SCAN");
     95    if (strncmp(kStrScan, "Scan", sizeof("Scan")) == 0)
     96        kStrScan = (char *)B_TRANSLATE("Scan");
     97       
    8298    kStrRescan = LoadString("STR_RESCAN");
     99    if (strncmp(kStrRescan, "Rescan", sizeof("Rescan")) == 0)
     100        kStrRescan = (char *)B_TRANSLATE("Rescan");
     101
    83102    kStrScanningX = LoadString("STR_SCN_X");
     103    if (strncmp(kStrScanningX, "Scanning ", sizeof("Scanning ")) == 0) {
     104        BString sScan(B_TRANSLATE("Scanning"));
     105        sScan << " ";
     106        kStrScanningX = (char *)sScan.String();
     107    }
     108
    84109    kStrUnavail = LoadString("STR_UNAVAIL");
     110    if (strncmp(kStrUnavail, "file unavailable", sizeof("file unavailable"))
     111        == 0)
     112        kStrUnavail = (char *)B_TRANSLATE("file unavailable");
     113
    85114    kVolMenuDefault = LoadString("STR_VM_DFLT");
     115    if (strncmp(kVolMenuDefault, "(Select)", sizeof("(Select)")) == 0)
     116        kVolMenuDefault = (char *)B_TRANSLATE("(Select)");
     117       
    86118    kVolPrompt = LoadString("STR_VPROMPT");
     119    if (strncmp(kVolPrompt, "Select a volume to scan",
     120        sizeof("Select a volume to scan")) == 0)
     121        kVolPrompt = (char *)B_TRANSLATE("Select a volume to scan");
     122
    87123    kMenuGetInfo = LoadString("STR_M_INFO");
     124    if (strncmp(kMenuGetInfo, "Get Info", sizeof("Get Info")) == 0)
     125        kMenuGetInfo = (char *)B_TRANSLATE("Get Info");
     126
    88127    kMenuOpen = LoadString("STR_M_OPEN");
     128    if (strncmp(kMenuOpen, "Open", sizeof("Open")) == 0)
     129        kMenuOpen = (char *)B_TRANSLATE("Open");
     130
    89131    kMenuOpenWith = LoadString("STR_M_OPENW");
     132    if (strncmp(kMenuOpenWith, "Open With", sizeof("Open With")) == 0)
     133        kMenuOpenWith = (char *)B_TRANSLATE("Open With");
     134
    90135    kMenuNoApps = LoadString("STR_M_NAPPS");
     136    if (strncmp(kMenuNoApps, "no supporting apps",
     137        sizeof("no supporting apps")) == 0)
     138        kMenuNoApps = (char *)B_TRANSLATE("no supporting apps");
     139
    91140    kInfoSize = LoadString("STR_SIZE");
     141    if (strncmp(kInfoSize, "Size", sizeof("Size")) == 0)
     142        kInfoSize = (char *)B_TRANSLATE("Size");
     143
    92144    kInfoInFiles = LoadString("STR_INFILES");
     145    if (strncmp(kInfoInFiles, " in %d files", sizeof(" in %d files")) == 0)
     146        kInfoInFiles = (char *)B_TRANSLATE(" in %d files");
     147
    93148    kInfoCreated = LoadString("STR_MADE");
     149    if (strncmp(kInfoCreated, "Created", sizeof("Created")) == 0)
     150        kInfoCreated = (char *)B_TRANSLATE("Created");
     151
    94152    kInfoModified = LoadString("STR_MOD");
     153    if (strncmp(kInfoModified, "Modified", sizeof("Modified")) == 0)
     154        kInfoModified = (char *)B_TRANSLATE("Modified");
     155
    95156    kInfoTimeFmt = LoadString("STR_TIMEFMT");
     157    if (strncmp(kInfoTimeFmt, "%a, %d %b %Y, %r",
     158        sizeof("%a, %d %b %Y, %r")) == 0)
     159        kInfoTimeFmt = (char *)B_TRANSLATE("%a, %d %b %Y, %r");
     160
    96161    kInfoKind = LoadString("STR_KIND");
     162    if (strncmp(kInfoKind, "Kind", sizeof("Kind")) == 0)
     163        kInfoKind = (char *)B_TRANSLATE("Kind");
     164
    97165    kInfoPath = LoadString("STR_PATH");
     166    if (strncmp(kInfoPath, "Path", sizeof("Path")) == 0)
     167        kInfoPath = (char *)B_TRANSLATE("Path");
     168
    98169    kOutdatedStr = LoadString("STR_OUTDATED");
     170    if (strncmp(kOutdatedStr, "Outdated view", sizeof("Outdated view")) == 0)
     171        kOutdatedStr = (char *)B_TRANSLATE("Outdated view");
    99172
    100173    kWindowColor = ui_color(B_PANEL_BACKGROUND_COLOR);
    101174    kOutlineColor = LoadColor("RGB_PIE_OL");