Ticket #13282: 0002-Add-localization-to-package-daemon-and-solver.patch
File 0002-Add-localization-to-package-daemon-and-solver.patch, 14.3 KB (added by , 8 years ago) |
---|
-
src/kits/package/solver/Jamfile
From 43ac9fda00f87f7b615367ad15d5657787ecc837 Mon Sep 17 00:00:00 2001 From: Humdinger <humdingerb@gmail.com> Date: Mon, 6 Feb 2017 16:49:35 +0100 Subject: [PATCH] Add localization to package daemon and solver --- src/kits/package/solver/Jamfile | 14 ++++++- src/kits/package/solver/LibsolvSolver.rdef | 14 +++++++ src/kits/package/solver/SolverProblem.cpp | 49 +++++++++++++--------- src/kits/package/solver/SolverProblemSolution.cpp | 51 +++++++++++++---------- src/servers/package/Jamfile | 11 ++++- src/servers/package/ProblemWindow.cpp | 30 ++++++++----- src/servers/package/ResultWindow.cpp | 22 ++++++---- 7 files changed, 128 insertions(+), 63 deletions(-) create mode 100644 src/kits/package/solver/LibsolvSolver.rdef diff --git a/src/kits/package/solver/Jamfile b/src/kits/package/solver/Jamfile index e9f8bdb..91c8261 100644
a b for architectureObject in [ MultiArchSubDirSetup ] { 12 12 = [ BuildFeatureAttribute libsolv : headers : path ] ; 13 13 UseHeaders [ FDirName $(libsolvHeaders) solv ] ; 14 14 15 AddResources $(libsolv) : 16 LibsolvSolver.rdef 17 ; 18 15 19 UsePrivateHeaders shared ; 16 20 17 21 SharedLibrary … … for architectureObject in [ MultiArchSubDirSetup ] { 21 25 : 22 26 package 23 27 [ BuildFeatureAttribute libsolv : libraries ] 24 be [ TargetLibstdc++ ]28 be localestub [ TargetLibstdc++ ] 25 29 ; 26 30 27 28 31 Includes [ FGristFiles LibsolvSolver.cpp ] 29 32 : [ BuildFeatureAttribute libsolv : headers ] ; 30 33 } 31 34 } 35 36 DoCatalogs libsolv : 37 x-vnd.Haiku-libsolvsolver 38 : 39 SolverProblem.cpp 40 SolverProblemSolution.cpp 41 ; -
new file src/kits/package/solver/LibsolvSolver.rdef
diff --git a/src/kits/package/solver/LibsolvSolver.rdef b/src/kits/package/solver/LibsolvSolver.rdef new file mode 100644 index 0000000..b930b11
- + 1 resource app_version { 2 major = 1, 3 middle = 0, 4 minor = 0, 5 6 variety = B_APPV_ALPHA, 7 8 internal = 7, 9 10 short_info = "Walter", 11 long_info = "©2001-2017 Haiku Inc." 12 }; 13 14 resource app_signature "application/x-vnd.Haiku-libsolvsolver" ; -
src/kits/package/solver/SolverProblem.cpp
diff --git a/src/kits/package/solver/SolverProblem.cpp b/src/kits/package/solver/SolverProblem.cpp index e0adce0..a6a6bfb 100644
a b 7 7 */ 8 8 9 9 10 #include <Catalog.h> 11 10 12 #include <package/solver/SolverProblem.h> 11 13 12 14 #include <package/solver/SolverPackage.h> 13 15 #include <package/solver/SolverProblemSolution.h> 14 16 15 17 18 #undef B_TRANSLATION_CONTEXT 19 #define B_TRANSLATION_CONTEXT "SolverProblem" 20 21 16 22 static const char* const kToStringTexts[] = { 17 "unspecified problem", 18 "%source% does not belong to a distupgrade repository", 19 "%source% has inferior architecture", 20 "problem with installed package %source%", 21 "conflicting requests", 22 "nothing provides requested %dependency%", 23 "%dependency% is provided by the system", 24 "dependency problem", 25 "package %source% is not installable", 26 "nothing provides %dependency% needed by %source%", 27 "cannot install both %source% and %target%", 28 "package %source% conflicts with %dependency% provided by %target%", 29 "package %source% obsoletes %dependency% provided by %target%", 30 "installed package %source% obsoletes %dependency% provided by %target%", 31 "package %source% implicitly obsoletes %dependency% provided by %target%", 32 "package %source% requires %dependency%, but none of the providers can be " 33 "installed", 34 "package %source% conflicts with %dependency% provided by itself" 23 B_TRANSLATE_MARK("unspecified problem"), 24 B_TRANSLATE_MARK("%source% does not belong to a distupgrade repository"), 25 B_TRANSLATE_MARK("%source% has inferior architecture"), 26 B_TRANSLATE_MARK("problem with installed package %source%"), 27 B_TRANSLATE_MARK("conflicting requests"), 28 B_TRANSLATE_MARK("nothing provides requested %dependency%"), 29 B_TRANSLATE_MARK("%dependency% is provided by the system"), 30 B_TRANSLATE_MARK("dependency problem"), 31 B_TRANSLATE_MARK("package %source% is not installable"), 32 B_TRANSLATE_MARK("nothing provides %dependency% needed by %source%"), 33 B_TRANSLATE_MARK("cannot install both %source% and %target%"), 34 B_TRANSLATE_MARK("package %source% conflicts with %dependency% provided " 35 "by %target%"), 36 B_TRANSLATE_MARK("package %source% obsoletes %dependency% provided by " 37 "%target%"), 38 B_TRANSLATE_MARK("installed package %source% obsoletes %dependency% " 39 "provided by %target%"), 40 B_TRANSLATE_MARK("package %source% implicitly obsoletes %dependency% " 41 "provided by %target%"), 42 B_TRANSLATE_MARK("package %source% requires %dependency%, but none of the " 43 "providers can be installed"), 44 B_TRANSLATE_MARK("package %source% conflicts with %dependency% provided by " 45 "itself") 35 46 }; 36 47 37 48 … … BSolverProblem::ToString() const 124 135 if (index >= sizeof(kToStringTexts) / sizeof(kToStringTexts[0])) 125 136 index = 0; 126 137 127 return BString( kToStringTexts[index])138 return BString(B_TRANSLATE_NOCOLLECT(kToStringTexts[index])) 128 139 .ReplaceAll("%source%", 129 140 fSourcePackage != NULL 130 141 ? fSourcePackage->VersionedName().String() : "?") -
src/kits/package/solver/SolverProblemSolution.cpp
diff --git a/src/kits/package/solver/SolverProblemSolution.cpp b/src/kits/package/solver/SolverProblemSolution.cpp index 26cf36f..44ff4c5 100644
a b 7 7 */ 8 8 9 9 10 #include <Catalog.h> 11 10 12 #include <package/solver/SolverProblemSolution.h> 11 13 12 14 #include <package/solver/SolverPackage.h> 13 15 14 16 17 #undef B_TRANSLATION_CONTEXT 18 #define B_TRANSLATION_CONTEXT "SolverProblemSolution" 19 20 15 21 static const char* const kToStringTexts[] = { 16 "do something", 17 "do not keep %source% installed", 18 "do not install \"%selection%\"", 19 "do not install the most recent version of \"%selection%\"", 20 "do not forbid installation of %source%", 21 "do not deinstall \"%selection%\"", 22 "do not deinstall all resolvables \"%selection%\"", 23 "do not lock \"%selection%\"", 24 "keep %source% despite its inferior architecture", 25 "keep %source% from excluded repository", 26 "keep old %source%", 27 "install %source% despite its inferior architecture", 28 "install %source% from excluded repository", 29 "install %selection% despite its old version", 30 "allow downgrade of %source% to %target%", 31 "allow name change of %source% to %target%", 32 "allow architecture change of %source% to %target%", 33 "allow vendor change from \"%sourceVendor%\" (%source%) to " 34 "\"%targetVendor%\" (%target%)", 35 "allow replacement of %source% with %target%", 36 "allow deinstallation of %source%" 22 B_TRANSLATE_MARK("do something"), 23 B_TRANSLATE_MARK("do not keep %source% installed"), 24 B_TRANSLATE_MARK("do not install \"%selection%\""), 25 B_TRANSLATE_MARK("do not install the most recent version of " 26 "\"%selection%\""), 27 B_TRANSLATE_MARK("do not forbid installation of %source%"), 28 B_TRANSLATE_MARK("do not deinstall \"%selection%\""), 29 B_TRANSLATE_MARK("do not deinstall all resolvables \"%selection%\""), 30 B_TRANSLATE_MARK("do not lock \"%selection%\""), 31 B_TRANSLATE_MARK("keep %source% despite its inferior architecture"), 32 B_TRANSLATE_MARK("keep %source% from excluded repository"), 33 B_TRANSLATE_MARK("keep old %source%"), 34 B_TRANSLATE_MARK("install %source% despite its inferior architecture"), 35 B_TRANSLATE_MARK("install %source% from excluded repository"), 36 B_TRANSLATE_MARK("install %selection% despite its old version"), 37 B_TRANSLATE_MARK("allow downgrade of %source% to %target%"), 38 B_TRANSLATE_MARK("allow name change of %source% to %target%"), 39 B_TRANSLATE_MARK("allow architecture change of %source% to %target%"), 40 B_TRANSLATE_MARK("allow vendor change from \"%sourceVendor%\" (%source%) " 41 "to \"%targetVendor%\" (%target%)"), 42 B_TRANSLATE_MARK("allow replacement of %source% with %target%"), 43 B_TRANSLATE_MARK("allow deinstallation of %source%") 37 44 }; 38 45 39 46 … … BSolverProblemSolutionElement::ToString() const 95 102 if (index >= sizeof(kToStringTexts) / sizeof(kToStringTexts[0])) 96 103 index = 0; 97 104 98 return BString( kToStringTexts[index])105 return BString(B_TRANSLATE_NOCOLLECT(kToStringTexts[index])) 99 106 .ReplaceAll("%source%", 100 107 fSourcePackage != NULL 101 108 ? fSourcePackage->VersionedName().String() : "?") -
src/servers/package/Jamfile
diff --git a/src/servers/package/Jamfile b/src/servers/package/Jamfile index b7b944c..ee33ef7 100644
a b Server package_daemon 24 24 Volume.cpp 25 25 VolumeState.cpp 26 26 : 27 be package27 be localestub package 28 28 [ TargetLibstdc++ ] 29 29 : 30 30 package_daemon.rdef 31 ; 31 ; 32 33 DoCatalogs package_daemon : 34 x-vnd.haiku-package_daemon 35 : 36 ProblemWindow.cpp 37 ResultWindow.cpp 38 ; -
src/servers/package/ProblemWindow.cpp
diff --git a/src/servers/package/ProblemWindow.cpp b/src/servers/package/ProblemWindow.cpp index 7b40ea7..a38cb2e 100644
a b 7 7 #include "ProblemWindow.h" 8 8 9 9 #include <Button.h> 10 #include <Catalog.h> 10 11 #include <GroupView.h> 11 12 #include <LayoutBuilder.h> 12 13 #include <RadioButton.h> … … 22 23 #include <ViewPort.h> 23 24 24 25 26 #undef B_TRANSLATION_CONTEXT 27 #define B_TRANSLATION_CONTEXT "PackageProblem" 28 25 29 using namespace BPackageKit; 26 30 27 31 using BPackageKit::BManager::BPrivate::BFatalErrorException; … … struct ProblemWindow::Solution { 53 57 54 58 ProblemWindow::ProblemWindow() 55 59 : 56 BWindow(BRect(0, 0, 400, 300), "Package problems", B_TITLED_WINDOW_LOOK, 60 BWindow(BRect(0, 0, 400, 300), B_TRANSLATE_COMMENT("Package problems", 61 "Window title"), B_TITLED_WINDOW_LOOK, 57 62 B_NORMAL_WINDOW_FEEL, 58 63 B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS, 59 64 B_ALL_WORKSPACES), … … ProblemWindow::ProblemWindow() 77 82 78 83 BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING) 79 84 .SetInsets(B_USE_SMALL_INSETS) 80 .Add(topTextView = new BStringView(NULL, 81 "The following problems have been encountered. Please select a"82 "solution for each:"))85 .Add(topTextView = new BStringView(NULL, B_TRANSLATE( 86 "The following problems have been encountered. Please select " 87 "a solution for each:"))) 83 88 .Add(new BScrollView(NULL, viewPort = new BViewPort(), 0, false, true)) 84 89 .AddGroup(B_HORIZONTAL) 85 .Add(fCancelButton = new BButton("Cancel", new BMessage(B_CANCEL))) 90 .Add(fCancelButton = new BButton(B_TRANSLATE("Cancel"), 91 new BMessage(B_CANCEL))) 86 92 .AddGlue() 87 .Add(fRetryButton = new BButton( "Retry",93 .Add(fRetryButton = new BButton(B_TRANSLATE("Retry"), 88 94 new BMessage(kRetryMessage))) 89 95 .End(); 90 96 … … ProblemWindow::_AddProblem(BSolverProblem* problem, 238 244 int32 solutionCount = problem->CountSolutions(); 239 245 for (int32 k = 0; k < solutionCount; k++) { 240 246 const BSolverProblemSolution* solution = problem->SolutionAt(k); 247 BString solutionText = B_TRANSLATE("solution"); 241 248 BRadioButton* solutionButton = new BRadioButton( 242 BString().SetToFormat("solution%" B_PRId32 ":", k + 1),249 solutionText << BString().SetToFormat(" %" B_PRId32 ":", k + 1), 243 250 new BMessage(kUpdateRetryButtonMessage)); 244 251 problemGroup->AddChild(solutionButton); 245 252 … … ProblemWindow::_AddProblem(BSolverProblem* problem, 261 268 fSolutions[solutionButton] = Solution(problem, solution); 262 269 } 263 270 264 BRadioButton* ignoreButton = new BRadioButton( "ignore problem for now",265 new BMessage(kUpdateRetryButtonMessage));271 BRadioButton* ignoreButton = new BRadioButton(B_TRANSLATE( 272 "ignore problem for now"), new BMessage(kUpdateRetryButtonMessage)); 266 273 problemGroup->AddChild(ignoreButton); 267 274 ignoreButton->SetValue(B_CONTROL_ON); 268 275 } … … ProblemWindow::_SolutionElementText( 278 285 if (element->Type() == BSolverProblemSolutionElement::B_ALLOW_DEINSTALLATION 279 286 && package != NULL 280 287 && fPackagesAddedByUser->find(package) != fPackagesAddedByUser->end()) { 281 return BString("don't activate package %source%").ReplaceAll( 282 "%source%", package->VersionedName()); 288 return BString(B_TRANSLATE_COMMENT("don't activate package %source%", 289 "don't change '%source%")).ReplaceAll( 290 "%source%", package->VersionedName()); 283 291 } 284 292 285 293 return element->ToString(); -
src/servers/package/ResultWindow.cpp
diff --git a/src/servers/package/ResultWindow.cpp b/src/servers/package/ResultWindow.cpp index 39253b4..ebc24e3 100644
a b 7 7 #include "ResultWindow.h" 8 8 9 9 #include <Button.h> 10 #include <Catalog.h> 10 11 #include <GroupView.h> 11 12 #include <LayoutBuilder.h> 12 13 #include <ScrollView.h> … … 19 20 #include <ViewPort.h> 20 21 21 22 23 #undef B_TRANSLATION_CONTEXT 24 #define B_TRANSLATION_CONTEXT "PackageResult" 25 22 26 using namespace BPackageKit; 23 27 24 28 … … static const uint32 kApplyMessage = 'rtry'; 27 31 28 32 ResultWindow::ResultWindow() 29 33 : 30 BWindow(BRect(0, 0, 400, 300), "Package changes", B_TITLED_WINDOW_LOOK, 34 BWindow(BRect(0, 0, 400, 300), B_TRANSLATE_COMMENT("Package changes", 35 "Window title"), B_TITLED_WINDOW_LOOK, 31 36 B_NORMAL_WINDOW_FEEL, 32 37 B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS, 33 38 B_ALL_WORKSPACES), … … ResultWindow::ResultWindow() 48 53 49 54 BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING) 50 55 .SetInsets(B_USE_SMALL_INSETS) 51 .Add(topTextView = new BStringView(NULL, 52 "The following additional package changes have to be made:"))56 .Add(topTextView = new BStringView(NULL, B_TRANSLATE( 57 "The following additional package changes have to be made:"))) 53 58 .Add(new BScrollView(NULL, viewPort = new BViewPort(), 0, false, true)) 54 59 .AddGroup(B_HORIZONTAL) 55 .Add(fCancelButton = new BButton("Cancel", new BMessage(B_CANCEL))) 60 .Add(fCancelButton = new BButton(B_TRANSLATE("Cancel"), 61 new BMessage(B_CANCEL))) 56 62 .AddGlue() 57 .Add(fApplyButton = new BButton( "Apply changes",63 .Add(fApplyButton = new BButton(B_TRANSLATE("Apply changes"), 58 64 new BMessage(kApplyMessage))) 59 65 .End(); 60 66 … … ResultWindow::_AddPackages(BGroupLayout* packagesGroup, 197 203 198 204 BString text; 199 205 if (install) { 200 text.SetToFormat("install package %s from repository %s\n", 206 text.SetToFormat(B_TRANSLATE_COMMENT("install package %s from " 207 "repository %s\n", "Don't change '%s' variables"), 201 208 package->Info().FileName().String(), 202 209 package->Repository()->Name().String()); 203 210 } else { 204 text.SetToFormat("uninstall package %s\n", 211 text.SetToFormat(B_TRANSLATE_COMMENT("uninstall package %s\n", 212 "Don't change '%s' variable"), 205 213 package->VersionedName().String()); 206 214 } 207 215