Ticket #13282: 0003-Add-localization-to-package-daemon-and-solver.patch

File 0003-Add-localization-to-package-daemon-and-solver.patch, 15.0 KB (added by humdinger, 8 years ago)

updated patch

  • src/kits/package/Jamfile

    From fc5e869a8ebc68f3e6912eef761b8ab9975b886b 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/Jamfile                          |  6 ++-
     src/kits/package/solver/Jamfile                   | 12 +++++-
     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 ++++++----
     8 files changed, 132 insertions(+), 63 deletions(-)
     create mode 100644 src/kits/package/solver/LibsolvSolver.rdef
    
    diff --git a/src/kits/package/Jamfile b/src/kits/package/Jamfile
    index 7d221f2..9063876 100644
    a b for architectureObject in [ MultiArchSubDirSetup ] {  
    7272        Includes [ FGristFiles InitTerminateLibPackage.cpp ]
    7373            : [ BuildFeatureAttribute curl : headers ] ;
    7474
     75        AddResources $(libsolv) :
     76            LibsolvSolver.rdef
     77            ;
     78
    7579        SharedLibrary [ MultiArchDefaultGristFiles libpackage.so ]
    7680            :
    7781            ActivateRepositoryCacheJob.cpp
    for architectureObject in [ MultiArchSubDirSetup ] {  
    130134            :
    131135            shared
    132136            bnetapi
    133             be
     137            be localestub
    134138            [ BuildFeatureAttribute curl : library ]
    135139            [ TargetLibstdc++ ]
    136140            $(TARGET_NETWORK_LIBS)
  • src/kits/package/solver/Jamfile

    diff --git a/src/kits/package/solver/Jamfile b/src/kits/package/solver/Jamfile
    index e9f8bdb..e4e75c2 100644
    a b for architectureObject in [ MultiArchSubDirSetup ] {  
    1212            = [ BuildFeatureAttribute libsolv : headers : path ] ;
    1313        UseHeaders [ FDirName $(libsolvHeaders) solv ] ;
    1414
     15        AddResources $(libsolv) :
     16            LibsolvSolver.rdef
     17            ;
     18
    1519        UsePrivateHeaders shared ;
    1620
    1721        SharedLibrary
    for architectureObject in [ MultiArchSubDirSetup ] {  
    2428            be [ TargetLibstdc++ ]
    2529        ;
    2630
    27 
    2831        Includes [ FGristFiles LibsolvSolver.cpp ]
    2932            : [ BuildFeatureAttribute libsolv : headers ] ;
    3033    }
    3134}
     35
     36DoCatalogs 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
    - +  
     1resource 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
     14resource 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  
    77 */
    88
    99
     10#include <Catalog.h>
     11
    1012#include <package/solver/SolverProblem.h>
    1113
    1214#include <package/solver/SolverPackage.h>
    1315#include <package/solver/SolverProblemSolution.h>
    1416
    1517
     18#undef B_TRANSLATION_CONTEXT
     19#define B_TRANSLATION_CONTEXT "SolverProblem"
     20
     21
    1622static 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")
    3546};
    3647
    3748
    BSolverProblem::ToString() const  
    124135    if (index >= sizeof(kToStringTexts) / sizeof(kToStringTexts[0]))
    125136        index = 0;
    126137
    127     return BString(kToStringTexts[index])
     138    return BString(B_TRANSLATE_NOCOLLECT(kToStringTexts[index]))
    128139        .ReplaceAll("%source%",
    129140            fSourcePackage != NULL
    130141                ? 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  
    77 */
    88
    99
     10#include <Catalog.h>
     11
    1012#include <package/solver/SolverProblemSolution.h>
    1113
    1214#include <package/solver/SolverPackage.h>
    1315
    1416
     17#undef B_TRANSLATION_CONTEXT
     18#define B_TRANSLATION_CONTEXT "SolverProblemSolution"
     19
     20
    1521static 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%")
    3744};
    3845
    3946
    BSolverProblemSolutionElement::ToString() const  
    95102    if (index >= sizeof(kToStringTexts) / sizeof(kToStringTexts[0]))
    96103        index = 0;
    97104
    98     return BString(kToStringTexts[index])
     105    return BString(B_TRANSLATE_NOCOLLECT(kToStringTexts[index]))
    99106        .ReplaceAll("%source%",
    100107            fSourcePackage != NULL
    101108                ? 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  
    2424    Volume.cpp
    2525    VolumeState.cpp
    2626    :
    27     be package
     27    be localestub package
    2828    [ TargetLibstdc++ ]
    2929    :
    3030    package_daemon.rdef
    31     ;
     31;
     32
     33DoCatalogs 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  
    77#include "ProblemWindow.h"
    88
    99#include <Button.h>
     10#include <Catalog.h>
    1011#include <GroupView.h>
    1112#include <LayoutBuilder.h>
    1213#include <RadioButton.h>
     
    2223#include <ViewPort.h>
    2324
    2425
     26#undef B_TRANSLATION_CONTEXT
     27#define B_TRANSLATION_CONTEXT "PackageProblem"
     28
    2529using namespace BPackageKit;
    2630
    2731using BPackageKit::BManager::BPrivate::BFatalErrorException;
    struct ProblemWindow::Solution {  
    5357
    5458ProblemWindow::ProblemWindow()
    5559    :
    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,
    5762        B_NORMAL_WINDOW_FEEL,
    5863        B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS,
    5964        B_ALL_WORKSPACES),
    ProblemWindow::ProblemWindow()  
    7782
    7883    BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
    7984        .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:")))
    8388        .Add(new BScrollView(NULL, viewPort = new BViewPort(), 0, false, true))
    8489        .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)))
    8692            .AddGlue()
    87             .Add(fRetryButton = new BButton("Retry",
     93            .Add(fRetryButton = new BButton(B_TRANSLATE("Retry"),
    8894                new BMessage(kRetryMessage)))
    8995        .End();
    9096
    ProblemWindow::_AddProblem(BSolverProblem* problem,  
    238244    int32 solutionCount = problem->CountSolutions();
    239245    for (int32 k = 0; k < solutionCount; k++) {
    240246        const BSolverProblemSolution* solution = problem->SolutionAt(k);
     247        BString solutionText = B_TRANSLATE("solution");
    241248        BRadioButton* solutionButton = new BRadioButton(
    242             BString().SetToFormat("solution %" B_PRId32 ":", k + 1),
     249            solutionText << BString().SetToFormat(" %" B_PRId32 ":", k + 1),
    243250            new BMessage(kUpdateRetryButtonMessage));
    244251        problemGroup->AddChild(solutionButton);
    245252
    ProblemWindow::_AddProblem(BSolverProblem* problem,  
    261268        fSolutions[solutionButton] = Solution(problem, solution);
    262269    }
    263270
    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));
    266273    problemGroup->AddChild(ignoreButton);
    267274    ignoreButton->SetValue(B_CONTROL_ON);
    268275}
    ProblemWindow::_SolutionElementText(  
    278285    if (element->Type() == BSolverProblemSolutionElement::B_ALLOW_DEINSTALLATION
    279286        && package != NULL
    280287        && 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());
    283291    }
    284292
    285293    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  
    77#include "ResultWindow.h"
    88
    99#include <Button.h>
     10#include <Catalog.h>
    1011#include <GroupView.h>
    1112#include <LayoutBuilder.h>
    1213#include <ScrollView.h>
     
    1920#include <ViewPort.h>
    2021
    2122
     23#undef B_TRANSLATION_CONTEXT
     24#define B_TRANSLATION_CONTEXT "PackageResult"
     25
    2226using namespace BPackageKit;
    2327
    2428
    static const uint32 kApplyMessage = 'rtry';  
    2731
    2832ResultWindow::ResultWindow()
    2933    :
    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,
    3136        B_NORMAL_WINDOW_FEEL,
    3237        B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS,
    3338        B_ALL_WORKSPACES),
    ResultWindow::ResultWindow()  
    4853
    4954    BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
    5055        .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:")))
    5358        .Add(new BScrollView(NULL, viewPort = new BViewPort(), 0, false, true))
    5459        .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)))
    5662            .AddGlue()
    57             .Add(fApplyButton = new BButton("Apply changes",
     63            .Add(fApplyButton = new BButton(B_TRANSLATE("Apply changes"),
    5864                new BMessage(kApplyMessage)))
    5965        .End();
    6066
    ResultWindow::_AddPackages(BGroupLayout* packagesGroup,  
    197203
    198204        BString text;
    199205        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"),
    201208                package->Info().FileName().String(),
    202209                package->Repository()->Name().String());
    203210        } else {
    204             text.SetToFormat("uninstall package %s\n",
     211            text.SetToFormat(B_TRANSLATE_COMMENT("uninstall package %s\n",
     212                    "Don't change '%s' variable"),
    205213                package->VersionedName().String());
    206214        }
    207215