Author: kirilla Date: 2009-11-15 02:42:47 +0100 (Sun, 15 Nov 2009) New Revision: 34050 Changeset: http://dev.haiku-os.org/changeset/34050/haiku Added: haiku/trunk/data/catalogs/add-ons/ haiku/trunk/data/catalogs/add-ons/tracker/ haiku/trunk/data/catalogs/add-ons/tracker/zipomatic/ haiku/trunk/data/catalogs/add-ons/tracker/zipomatic/sv.catkeys Modified: haiku/trunk/src/add-ons/tracker/zipomatic/Jamfile haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.cpp haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.h haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMaticWindow.cpp haiku/trunk/src/add-ons/tracker/zipomatic/ZipperThread.cpp Log: i18n, initial translation to Swedish Added: haiku/trunk/data/catalogs/add-ons/tracker/zipomatic/sv.catkeys =================================================================== --- haiku/trunk/data/catalogs/add-ons/tracker/zipomatic/sv.catkeys (rev 0) +++ haiku/trunk/data/catalogs/add-ons/tracker/zipomatic/sv.catkeys 2009-11-15 01:42:47 UTC (rev 34050) @@ -0,0 +1,18 @@ +1 svenska x-vnd.haiku.zip-o-matic 274748138 +1 file added. file:ZipOMaticWindow.cpp 1 fil tillagd. +Stop file:ZipOMaticWindow.cpp Avbryt +Creating archive: %s file:ZipOMaticWindow.cpp Skapar fil: %s +Continue file:ZipOMaticWindow.cpp Fortsätt +Preparing to archive file:ZipperThread.cpp Förbereder... +Filename: %s file:ZipOMaticWindow.cpp Filnamn: %s +Let them continue file:ZipOMatic.cpp Låt dem fortsätta +Do you want to stop them? file:ZipOMatic.cpp Vill du avbryta dem? +Are you sure you want to stop creating this archive? file:ZipOMaticWindow.cpp Vill du avbryta skapandet av den här filen? +%ld files added. file:ZipOMaticWindow.cpp %ld filer tillagda. +Stopped file:ZipOMaticWindow.cpp Avbruten +Archive file:ZipperThread.cpp Arkiv +Drop files to zip. file:ZipOMaticWindow.cpp Släpp filer här för att zippa dem. +Error creating archive file:ZipOMaticWindow.cpp Något gick snett. +You have %ld Zip-O-Matic running.\n\n file:ZipOMatic.cpp %ld Zip-O-Matic är igång.\n\n +Archive created OK file:ZipOMaticWindow.cpp Zipfil skapad utan problem. +Stop them file:ZipOMatic.cpp Avbryt dem Modified: haiku/trunk/src/add-ons/tracker/zipomatic/Jamfile =================================================================== --- haiku/trunk/src/add-ons/tracker/zipomatic/Jamfile 2009-11-15 00:12:27 UTC (rev 34049) +++ haiku/trunk/src/add-ons/tracker/zipomatic/Jamfile 2009-11-15 01:42:47 UTC (rev 34050) @@ -9,6 +9,17 @@ ZipOMaticWindow.cpp ZipperThread.cpp - : be tracker $(TARGET_LIBSUPC++) + : be tracker $(TARGET_LIBSUPC++) liblocale.so : ZipOMatic.rdef ; + +DoCatalogs ZipOMatic-Z : + x-vnd.haiku.zip-o-matic + : + ZipOMatic.cpp + ZipOMaticWindow.cpp + ZipperThread.cpp + : en.catalog + : sv.catkeys + ; + Modified: haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.cpp =================================================================== --- haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.cpp 2009-11-15 00:12:27 UTC (rev 34049) +++ haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.cpp 2009-11-15 01:42:47 UTC (rev 34050) @@ -17,6 +17,9 @@ #include "ZipOMaticWindow.h" +#define TR_CONTEXT "file:ZipOMatic.cpp" + + int main() { @@ -33,6 +36,7 @@ fGotRefs(false), fInvoker(new BInvoker(new BMessage(ZIPPO_QUIT_OR_CONTINUE), NULL, this)) { + be_locale->GetAppCatalog(&fCatalog); } @@ -149,11 +153,15 @@ // in that zippers are not paused while the BAlert is up. BString question; - question << "You have " << zippoCount; - question << " Zip-O-Matic running.\n\nDo you want to stop them?"; + question << TR("You have %ld Zip-O-Matic running.\n\n"); + question << TR("Do you want to stop them?"); + + BString temp; + temp << zippoCount; + question.ReplaceFirst("%ld", temp.String()); - BAlert* alert = new BAlert("Stop or Continue", question.String(), - "Stop them", "Let them continue", NULL, B_WIDTH_AS_USUAL, + BAlert* alert = new BAlert(NULL, question.String(), + TR("Stop them"), TR("Let them continue"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->Go(fInvoker); alert->Activate(); Modified: haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.h =================================================================== --- haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.h 2009-11-15 00:12:27 UTC (rev 34049) +++ haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.h 2009-11-15 01:42:47 UTC (rev 34050) @@ -3,7 +3,9 @@ #include <Application.h> +#include <Catalog.h> #include <Invoker.h> +#include <Locale.h> #include <Message.h> @@ -26,6 +28,8 @@ bool fGotRefs; BInvoker* fInvoker; + + BCatalog fCatalog; }; #endif // _ZIPOMATIC_H_ Modified: haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMaticWindow.cpp =================================================================== --- haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMaticWindow.cpp 2009-11-15 00:12:27 UTC (rev 34049) +++ haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMaticWindow.cpp 2009-11-15 01:42:47 UTC (rev 34050) @@ -14,11 +14,13 @@ #include <Alert.h> #include <Application.h> +#include <Catalog.h> #include <Directory.h> #include <File.h> #include <FindDirectory.h> #include <GroupLayout.h> #include <LayoutBuilder.h> +#include <Locale.h> #include <Path.h> #include <Roster.h> #include <Screen.h> @@ -31,6 +33,9 @@ #include "ZipperThread.h" +#define TR_CONTEXT "file:ZipOMaticWindow.cpp" + + ZippoWindow::ZippoWindow(BList windowList, bool keepOpen) : BWindow(BRect(0, 0, 0, 0), "Zip-O-Matic", B_TITLED_WINDOW, @@ -50,11 +55,11 @@ fArchiveNameView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); - fZipOutputView = new BStringView("output_text", "Drop files to zip."); + fZipOutputView = new BStringView("output_text", TR("Drop files to zip.")); fZipOutputView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); - fStopButton = new BButton("stop", "Stop", new BMessage(B_QUIT_REQUESTED)); + fStopButton = new BButton("stop", TR("Stop"), new BMessage(B_QUIT_REQUESTED)); fStopButton->SetEnabled(false); fStopButton->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET)); @@ -102,9 +107,9 @@ fStopButton->SetEnabled(false); fArchiveNameView->SetText(" "); if (fZippingWasStopped) - fZipOutputView->SetText("Stopped"); + fZipOutputView->SetText(TR("Stopped")); else - fZipOutputView->SetText("Archive created OK"); + fZipOutputView->SetText(TR("Archive created OK")); _CloseWindowOrKeepOpen(); break; @@ -115,16 +120,17 @@ fActivityView->Stop(); fStopButton->SetEnabled(false); fArchiveNameView->SetText(""); - fZipOutputView->SetText("Error creating archive"); + fZipOutputView->SetText(TR("Error creating archive")); break; case ZIPPO_TASK_DESCRIPTION: { - BString string; - if (message->FindString("archive_filename", &string) == B_OK) { - fArchiveName = string; - string.Prepend("Creating archive: "); - fArchiveNameView->SetText(string.String()); + BString filename; + if (message->FindString("archive_filename", &filename) == B_OK) { + fArchiveName = filename; + BString temp(TR("Creating archive: %s")); + temp.ReplaceFirst("%s", filename.String()); + fArchiveNameView->SetText(temp.String()); } break; } @@ -133,8 +139,7 @@ { BString string; if (message->FindString("zip_output", &string) == B_OK) { - if (string.FindFirst("Adding: ") == 0 - || string.FindFirst("Updating: ") == 0) { + if (string.FindFirst("Adding: ") == 0) { // This is a workaround for the current window resizing // behavior as the window resizes for each line of output. @@ -143,22 +148,19 @@ // being created (added to) or if we're updating an // already existing archive. + BString output; fFileCount++; - BString countString; - countString << fFileCount; + BString count; + count << fFileCount; - if (fFileCount == 1) - countString << " file"; - else - countString << " files"; + if (fFileCount == 1) { + output << TR("1 file added."); + } else { + output << TR("%ld files added."); + output.ReplaceFirst("%ld", count.String()); + } - if (string.FindFirst("Adding: ") == 0) - countString << " added."; - - if (string.FindFirst("Updating: ") == 0) - countString << " updated."; - - fZipOutputView->SetText(countString.String()); + fZipOutputView->SetText(output.String()); } else { fZipOutputView->SetText(string.String()); } @@ -202,11 +204,14 @@ fActivityView->Pause(); BString message; - message << "Are you sure you want to stop creating this archive?\n\n"; - message << "Filename: " << fArchiveName.String() << "\n"; + message << TR("Are you sure you want to stop creating this archive?"); + message << "\n\n"; + message << TR("Filename: %s"); + message << "\n"; + message.ReplaceFirst("%s", fArchiveName.String()); - BAlert* alert = new BAlert(NULL, message.String(), "Stop", - "Continue", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + BAlert* alert = new BAlert(NULL, message.String(), TR("Stop"), + TR("Continue"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->Go(fWindowInvoker); return false; @@ -244,7 +249,7 @@ fThread = NULL; fArchiveNameView->SetText(" "); - fZipOutputView->SetText("Stopped"); + fZipOutputView->SetText(TR("Stopped")); _CloseWindowOrKeepOpen(); } Modified: haiku/trunk/src/add-ons/tracker/zipomatic/ZipperThread.cpp =================================================================== --- haiku/trunk/src/add-ons/tracker/zipomatic/ZipperThread.cpp 2009-11-15 00:12:27 UTC (rev 34049) +++ haiku/trunk/src/add-ons/tracker/zipomatic/ZipperThread.cpp 2009-11-15 01:42:47 UTC (rev 34050) @@ -15,7 +15,9 @@ #include <string.h> #include <unistd.h> -#include <FindDirectory.h> +#include <Catalog.h> +#include <FindDirectory.h> +#include <Locale.h> #include <Locker.h> #include <Message.h> #include <Path.h> @@ -25,6 +27,9 @@ #include "ZipOMaticWindow.h" +#define TR_CONTEXT "file:ZipperThread.cpp" + + ZipperThread::ZipperThread(BMessage* refsMessage, BWindow* window) : GenericThread("ZipperThread", B_NORMAL_PRIORITY, refsMessage), @@ -107,7 +112,7 @@ BString archiveName; if (refCount > 1) - archiveName = "Archive"; + archiveName = TR("Archive"); else archiveName = lastRef.name; @@ -165,7 +170,7 @@ _SendMessageToWindow(ZIPPO_TASK_DESCRIPTION, "archive_filename", archiveName.String()); _SendMessageToWindow(ZIPPO_LINE_OF_STDOUT, "zip_output", - "Preparing to archive"); + TR("Preparing to archive")); return B_OK; }