Add localization to package daemon and solver
Thanks to Adrien and Rene for reviewing and guidance. Fixes #13282.
This commit is contained in:
parent
42d4bb33f8
commit
cf0ba058ec
@ -72,6 +72,10 @@ for architectureObject in [ MultiArchSubDirSetup ] {
|
||||
Includes [ FGristFiles InitTerminateLibPackage.cpp ]
|
||||
: [ BuildFeatureAttribute curl : headers ] ;
|
||||
|
||||
AddResources $(libsolv) :
|
||||
LibsolvSolver.rdef
|
||||
;
|
||||
|
||||
SharedLibrary [ MultiArchDefaultGristFiles libpackage.so ]
|
||||
:
|
||||
ActivateRepositoryCacheJob.cpp
|
||||
@ -130,7 +134,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
|
||||
:
|
||||
shared
|
||||
bnetapi
|
||||
be
|
||||
be localestub
|
||||
[ BuildFeatureAttribute curl : library ]
|
||||
[ TargetLibstdc++ ]
|
||||
$(TARGET_NETWORK_LIBS)
|
||||
|
@ -12,6 +12,10 @@ for architectureObject in [ MultiArchSubDirSetup ] {
|
||||
= [ BuildFeatureAttribute libsolv : headers : path ] ;
|
||||
UseHeaders [ FDirName $(libsolvHeaders) solv ] ;
|
||||
|
||||
AddResources $(libsolv) :
|
||||
LibsolvSolver.rdef
|
||||
;
|
||||
|
||||
UsePrivateHeaders shared ;
|
||||
|
||||
SharedLibrary
|
||||
@ -24,8 +28,14 @@ for architectureObject in [ MultiArchSubDirSetup ] {
|
||||
be [ TargetLibstdc++ ]
|
||||
;
|
||||
|
||||
|
||||
Includes [ FGristFiles LibsolvSolver.cpp ]
|
||||
: [ BuildFeatureAttribute libsolv : headers ] ;
|
||||
}
|
||||
}
|
||||
|
||||
DoCatalogs libsolv :
|
||||
x-vnd.Haiku-libsolvsolver
|
||||
:
|
||||
SolverProblem.cpp
|
||||
SolverProblemSolution.cpp
|
||||
;
|
||||
|
14
src/kits/package/solver/LibsolvSolver.rdef
Normal file
14
src/kits/package/solver/LibsolvSolver.rdef
Normal file
@ -0,0 +1,14 @@
|
||||
resource app_version {
|
||||
major = 1,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
|
||||
variety = B_APPV_ALPHA,
|
||||
|
||||
internal = 7,
|
||||
|
||||
short_info = "Walter",
|
||||
long_info = "©2001-2017 Haiku Inc."
|
||||
};
|
||||
|
||||
resource app_signature "application/x-vnd.Haiku-libsolvsolver" ;
|
@ -7,31 +7,42 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <Catalog.h>
|
||||
|
||||
#include <package/solver/SolverProblem.h>
|
||||
|
||||
#include <package/solver/SolverPackage.h>
|
||||
#include <package/solver/SolverProblemSolution.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "SolverProblem"
|
||||
|
||||
|
||||
static const char* const kToStringTexts[] = {
|
||||
"unspecified problem",
|
||||
"%source% does not belong to a distupgrade repository",
|
||||
"%source% has inferior architecture",
|
||||
"problem with installed package %source%",
|
||||
"conflicting requests",
|
||||
"nothing provides requested %dependency%",
|
||||
"%dependency% is provided by the system",
|
||||
"dependency problem",
|
||||
"package %source% is not installable",
|
||||
"nothing provides %dependency% needed by %source%",
|
||||
"cannot install both %source% and %target%",
|
||||
"package %source% conflicts with %dependency% provided by %target%",
|
||||
"package %source% obsoletes %dependency% provided by %target%",
|
||||
"installed package %source% obsoletes %dependency% provided by %target%",
|
||||
"package %source% implicitly obsoletes %dependency% provided by %target%",
|
||||
"package %source% requires %dependency%, but none of the providers can be "
|
||||
"installed",
|
||||
"package %source% conflicts with %dependency% provided by itself"
|
||||
B_TRANSLATE_MARK("unspecified problem"),
|
||||
B_TRANSLATE_MARK("%source% does not belong to a distupgrade repository"),
|
||||
B_TRANSLATE_MARK("%source% has inferior architecture"),
|
||||
B_TRANSLATE_MARK("problem with installed package %source%"),
|
||||
B_TRANSLATE_MARK("conflicting requests"),
|
||||
B_TRANSLATE_MARK("nothing provides requested %dependency%"),
|
||||
B_TRANSLATE_MARK("%dependency% is provided by the system"),
|
||||
B_TRANSLATE_MARK("dependency problem"),
|
||||
B_TRANSLATE_MARK("package %source% is not installable"),
|
||||
B_TRANSLATE_MARK("nothing provides %dependency% needed by %source%"),
|
||||
B_TRANSLATE_MARK("cannot install both %source% and %target%"),
|
||||
B_TRANSLATE_MARK("package %source% conflicts with %dependency% provided "
|
||||
"by %target%"),
|
||||
B_TRANSLATE_MARK("package %source% obsoletes %dependency% provided by "
|
||||
"%target%"),
|
||||
B_TRANSLATE_MARK("installed package %source% obsoletes %dependency% "
|
||||
"provided by %target%"),
|
||||
B_TRANSLATE_MARK("package %source% implicitly obsoletes %dependency% "
|
||||
"provided by %target%"),
|
||||
B_TRANSLATE_MARK("package %source% requires %dependency%, but none of the "
|
||||
"providers can be installed"),
|
||||
B_TRANSLATE_MARK("package %source% conflicts with %dependency% provided by "
|
||||
"itself")
|
||||
};
|
||||
|
||||
|
||||
@ -124,7 +135,7 @@ BSolverProblem::ToString() const
|
||||
if (index >= sizeof(kToStringTexts) / sizeof(kToStringTexts[0]))
|
||||
index = 0;
|
||||
|
||||
return BString(kToStringTexts[index])
|
||||
return BString(B_TRANSLATE_NOCOLLECT(kToStringTexts[index]))
|
||||
.ReplaceAll("%source%",
|
||||
fSourcePackage != NULL
|
||||
? fSourcePackage->VersionedName().String() : "?")
|
||||
|
@ -7,33 +7,40 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <Catalog.h>
|
||||
|
||||
#include <package/solver/SolverProblemSolution.h>
|
||||
|
||||
#include <package/solver/SolverPackage.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "SolverProblemSolution"
|
||||
|
||||
|
||||
static const char* const kToStringTexts[] = {
|
||||
"do something",
|
||||
"do not keep %source% installed",
|
||||
"do not install \"%selection%\"",
|
||||
"do not install the most recent version of \"%selection%\"",
|
||||
"do not forbid installation of %source%",
|
||||
"do not deinstall \"%selection%\"",
|
||||
"do not deinstall all resolvables \"%selection%\"",
|
||||
"do not lock \"%selection%\"",
|
||||
"keep %source% despite its inferior architecture",
|
||||
"keep %source% from excluded repository",
|
||||
"keep old %source%",
|
||||
"install %source% despite its inferior architecture",
|
||||
"install %source% from excluded repository",
|
||||
"install %selection% despite its old version",
|
||||
"allow downgrade of %source% to %target%",
|
||||
"allow name change of %source% to %target%",
|
||||
"allow architecture change of %source% to %target%",
|
||||
"allow vendor change from \"%sourceVendor%\" (%source%) to "
|
||||
"\"%targetVendor%\" (%target%)",
|
||||
"allow replacement of %source% with %target%",
|
||||
"allow deinstallation of %source%"
|
||||
B_TRANSLATE_MARK("do something"),
|
||||
B_TRANSLATE_MARK("do not keep %source% installed"),
|
||||
B_TRANSLATE_MARK("do not install \"%selection%\""),
|
||||
B_TRANSLATE_MARK("do not install the most recent version of "
|
||||
"\"%selection%\""),
|
||||
B_TRANSLATE_MARK("do not forbid installation of %source%"),
|
||||
B_TRANSLATE_MARK("do not deinstall \"%selection%\""),
|
||||
B_TRANSLATE_MARK("do not deinstall all resolvables \"%selection%\""),
|
||||
B_TRANSLATE_MARK("do not lock \"%selection%\""),
|
||||
B_TRANSLATE_MARK("keep %source% despite its inferior architecture"),
|
||||
B_TRANSLATE_MARK("keep %source% from excluded repository"),
|
||||
B_TRANSLATE_MARK("keep old %source%"),
|
||||
B_TRANSLATE_MARK("install %source% despite its inferior architecture"),
|
||||
B_TRANSLATE_MARK("install %source% from excluded repository"),
|
||||
B_TRANSLATE_MARK("install %selection% despite its old version"),
|
||||
B_TRANSLATE_MARK("allow downgrade of %source% to %target%"),
|
||||
B_TRANSLATE_MARK("allow name change of %source% to %target%"),
|
||||
B_TRANSLATE_MARK("allow architecture change of %source% to %target%"),
|
||||
B_TRANSLATE_MARK("allow vendor change from \"%sourceVendor%\" (%source%) "
|
||||
"to \"%targetVendor%\" (%target%)"),
|
||||
B_TRANSLATE_MARK("allow replacement of %source% with %target%"),
|
||||
B_TRANSLATE_MARK("allow deinstallation of %source%")
|
||||
};
|
||||
|
||||
|
||||
@ -95,7 +102,7 @@ BSolverProblemSolutionElement::ToString() const
|
||||
if (index >= sizeof(kToStringTexts) / sizeof(kToStringTexts[0]))
|
||||
index = 0;
|
||||
|
||||
return BString(kToStringTexts[index])
|
||||
return BString(B_TRANSLATE_NOCOLLECT(kToStringTexts[index]))
|
||||
.ReplaceAll("%source%",
|
||||
fSourcePackage != NULL
|
||||
? fSourcePackage->VersionedName().String() : "?")
|
||||
|
@ -24,8 +24,15 @@ Server package_daemon
|
||||
Volume.cpp
|
||||
VolumeState.cpp
|
||||
:
|
||||
be package
|
||||
be localestub package
|
||||
[ TargetLibstdc++ ]
|
||||
:
|
||||
package_daemon.rdef
|
||||
;
|
||||
;
|
||||
|
||||
DoCatalogs package_daemon :
|
||||
x-vnd.haiku-package_daemon
|
||||
:
|
||||
ProblemWindow.cpp
|
||||
ResultWindow.cpp
|
||||
;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "ProblemWindow.h"
|
||||
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <GroupView.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <RadioButton.h>
|
||||
@ -22,6 +23,9 @@
|
||||
#include <ViewPort.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "PackageProblem"
|
||||
|
||||
using namespace BPackageKit;
|
||||
|
||||
using BPackageKit::BManager::BPrivate::BFatalErrorException;
|
||||
@ -53,7 +57,8 @@ struct ProblemWindow::Solution {
|
||||
|
||||
ProblemWindow::ProblemWindow()
|
||||
:
|
||||
BWindow(BRect(0, 0, 400, 300), "Package problems", B_TITLED_WINDOW_LOOK,
|
||||
BWindow(BRect(0, 0, 400, 300), B_TRANSLATE_COMMENT("Package problems",
|
||||
"Window title"), B_TITLED_WINDOW_LOOK,
|
||||
B_NORMAL_WINDOW_FEEL,
|
||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS,
|
||||
B_ALL_WORKSPACES),
|
||||
@ -77,14 +82,15 @@ ProblemWindow::ProblemWindow()
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
|
||||
.SetInsets(B_USE_SMALL_INSETS)
|
||||
.Add(topTextView = new BStringView(NULL,
|
||||
"The following problems have been encountered. Please select a "
|
||||
"solution for each:"))
|
||||
.Add(topTextView = new BStringView(NULL, B_TRANSLATE(
|
||||
"The following problems have been encountered. Please select "
|
||||
"a solution for each:")))
|
||||
.Add(new BScrollView(NULL, viewPort = new BViewPort(), 0, false, true))
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(fCancelButton = new BButton("Cancel", new BMessage(B_CANCEL)))
|
||||
.Add(fCancelButton = new BButton(B_TRANSLATE("Cancel"),
|
||||
new BMessage(B_CANCEL)))
|
||||
.AddGlue()
|
||||
.Add(fRetryButton = new BButton("Retry",
|
||||
.Add(fRetryButton = new BButton(B_TRANSLATE("Retry"),
|
||||
new BMessage(kRetryMessage)))
|
||||
.End();
|
||||
|
||||
@ -236,10 +242,11 @@ ProblemWindow::_AddProblem(BSolverProblem* problem,
|
||||
problemView->AdoptParentColors();
|
||||
|
||||
int32 solutionCount = problem->CountSolutions();
|
||||
for (int32 k = 0; k < solutionCount; k++) {
|
||||
for (int k = 0; k < solutionCount; k++) {
|
||||
const BSolverProblemSolution* solution = problem->SolutionAt(k);
|
||||
BRadioButton* solutionButton = new BRadioButton(
|
||||
BString().SetToFormat("solution %" B_PRId32 ":", k + 1),
|
||||
BString().SetToFormat(B_TRANSLATE_COMMENT("solution %d:",
|
||||
"Don't change the %d variable"), k + 1),
|
||||
new BMessage(kUpdateRetryButtonMessage));
|
||||
problemGroup->AddChild(solutionButton);
|
||||
|
||||
@ -261,8 +268,8 @@ ProblemWindow::_AddProblem(BSolverProblem* problem,
|
||||
fSolutions[solutionButton] = Solution(problem, solution);
|
||||
}
|
||||
|
||||
BRadioButton* ignoreButton = new BRadioButton("ignore problem for now",
|
||||
new BMessage(kUpdateRetryButtonMessage));
|
||||
BRadioButton* ignoreButton = new BRadioButton(B_TRANSLATE(
|
||||
"ignore problem for now"), new BMessage(kUpdateRetryButtonMessage));
|
||||
problemGroup->AddChild(ignoreButton);
|
||||
ignoreButton->SetValue(B_CONTROL_ON);
|
||||
}
|
||||
@ -278,8 +285,9 @@ ProblemWindow::_SolutionElementText(
|
||||
if (element->Type() == BSolverProblemSolutionElement::B_ALLOW_DEINSTALLATION
|
||||
&& package != NULL
|
||||
&& fPackagesAddedByUser->find(package) != fPackagesAddedByUser->end()) {
|
||||
return BString("don't activate package %source%").ReplaceAll(
|
||||
"%source%", package->VersionedName());
|
||||
return BString(B_TRANSLATE_COMMENT("don't activate package %source%",
|
||||
"don't change '%source%")).ReplaceAll(
|
||||
"%source%", package->VersionedName());
|
||||
}
|
||||
|
||||
return element->ToString();
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "ResultWindow.h"
|
||||
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <GroupView.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <ScrollView.h>
|
||||
@ -19,6 +20,9 @@
|
||||
#include <ViewPort.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "PackageResult"
|
||||
|
||||
using namespace BPackageKit;
|
||||
|
||||
|
||||
@ -27,7 +31,8 @@ static const uint32 kApplyMessage = 'rtry';
|
||||
|
||||
ResultWindow::ResultWindow()
|
||||
:
|
||||
BWindow(BRect(0, 0, 400, 300), "Package changes", B_TITLED_WINDOW_LOOK,
|
||||
BWindow(BRect(0, 0, 400, 300), B_TRANSLATE_COMMENT("Package changes",
|
||||
"Window title"), B_TITLED_WINDOW_LOOK,
|
||||
B_NORMAL_WINDOW_FEEL,
|
||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS,
|
||||
B_ALL_WORKSPACES),
|
||||
@ -48,13 +53,14 @@ ResultWindow::ResultWindow()
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
|
||||
.SetInsets(B_USE_SMALL_INSETS)
|
||||
.Add(topTextView = new BStringView(NULL,
|
||||
"The following additional package changes have to be made:"))
|
||||
.Add(topTextView = new BStringView(NULL, B_TRANSLATE(
|
||||
"The following additional package changes have to be made:")))
|
||||
.Add(new BScrollView(NULL, viewPort = new BViewPort(), 0, false, true))
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(fCancelButton = new BButton("Cancel", new BMessage(B_CANCEL)))
|
||||
.Add(fCancelButton = new BButton(B_TRANSLATE("Cancel"),
|
||||
new BMessage(B_CANCEL)))
|
||||
.AddGlue()
|
||||
.Add(fApplyButton = new BButton("Apply changes",
|
||||
.Add(fApplyButton = new BButton(B_TRANSLATE("Apply changes"),
|
||||
new BMessage(kApplyMessage)))
|
||||
.End();
|
||||
|
||||
@ -197,11 +203,13 @@ ResultWindow::_AddPackages(BGroupLayout* packagesGroup,
|
||||
|
||||
BString text;
|
||||
if (install) {
|
||||
text.SetToFormat("install package %s from repository %s\n",
|
||||
text.SetToFormat(B_TRANSLATE_COMMENT("install package %s from "
|
||||
"repository %s\n", "Don't change '%s' variables"),
|
||||
package->Info().FileName().String(),
|
||||
package->Repository()->Name().String());
|
||||
} else {
|
||||
text.SetToFormat("uninstall package %s\n",
|
||||
text.SetToFormat(B_TRANSLATE_COMMENT("uninstall package %s\n",
|
||||
"Don't change '%s' variable"),
|
||||
package->VersionedName().String());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user