VirtualBox

Ignore:
Timestamp:
Nov 11, 2021 2:45:18 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148226
Message:

Main: bugref:1909: Added translation marks around messages of VBoxManage output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp

    r86820 r92372  
    4444using namespace com;
    4545
     46DECLARE_TRANSLATION_CONTEXT(DHCPServer);
    4647
    4748/*********************************************************************************************************************************
     
    6162        case DHCPD_CMD_COMMON_OPT_NETWORK: \
    6263            if ((a_pCtx)->pszInterface != NULL) \
    63                 return errorSyntax("Either --network or --interface, not both"); \
     64                return errorSyntax(DHCPServer::tr("Either --network or --interface, not both")); \
    6465            (a_pCtx)->pszNetwork = ValueUnion.psz; \
    6566            break; \
    6667        case DHCPD_CMD_COMMON_OPT_INTERFACE: \
    6768            if ((a_pCtx)->pszNetwork != NULL) \
    68                 return errorSyntax("Either --interface or --network, not both"); \
     69                return errorSyntax(DHCPServer::tr("Either --interface or --network, not both")); \
    6970            (a_pCtx)->pszInterface = ValueUnion.psz; \
    7071            break
     
    176177            if (FAILED(hrc))
    177178            {
    178                 errorArgument("Failed to locate host-only interface '%s'", pCtx->pszInterface);
     179                errorArgument(DHCPServer::tr("Failed to locate host-only interface '%s'"), pCtx->pszInterface);
    179180                return ptrRet;
    180181            }
     
    190191            return ptrRet;
    191192        if (pCtx->pszNetwork)
    192             errorArgument("Failed to find DHCP server for network '%s'", pCtx->pszNetwork);
     193            errorArgument(DHCPServer::tr("Failed to find DHCP server for network '%s'"), pCtx->pszNetwork);
    193194        else
    194             errorArgument("Failed to find DHCP server for host-only interface '%s' (network '%ls')",
     195            errorArgument(DHCPServer::tr("Failed to find DHCP server for host-only interface '%s' (network '%ls')"),
    195196                          pCtx->pszInterface, bstrNetName.raw());
    196197    }
    197198    else
    198         errorSyntax("You need to specify either --network or --interface to identify the DHCP server");
     199        errorSyntax(DHCPServer::tr("You need to specify either --network or --interface to identify the DHCP server"));
    199200    return ptrRet;
    200201}
     
    470471                case 'g':   // --global     Sets the option scope to 'global'.
    471472                    if (fNeedValueOrRemove)
    472                         return errorSyntax("Incomplete option sequence preseeding '--global'");
     473                        return errorSyntax(DHCPServer::tr("Incomplete option sequence preseeding '--global'"));
    473474                    Scope.setGlobal();
    474475                    break;
     
    476477                case 'G':   // --group
    477478                    if (fNeedValueOrRemove)
    478                         return errorSyntax("Incomplete option sequence preseeding '--group'");
     479                        return errorSyntax(DHCPServer::tr("Incomplete option sequence preseeding '--group'"));
    479480                    if (!*ValueUnion.psz)
    480                         return errorSyntax("Group name cannot be empty");
     481                        return errorSyntax(DHCPServer::tr("Group name cannot be empty"));
    481482                    Scope.setGroup(ValueUnion.psz);
    482483                    break;
     
    484485                case 'E':   // --mac-address
    485486                    if (fNeedValueOrRemove)
    486                         return errorSyntax("Incomplete option sequence preseeding '--mac-address'");
     487                        return errorSyntax(DHCPServer::tr("Incomplete option sequence preseeding '--mac-address'"));
    487488                    RTStrPrintf(szMACAddress, sizeof(szMACAddress), "%RTmac", &ValueUnion.MacAddr);
    488489                    Scope.setMACAddress(szMACAddress);
     
    491492                case 'M':   // --vm         Sets the option scope to ValueUnion.psz + 0.
    492493                    if (fNeedValueOrRemove)
    493                         return errorSyntax("Incomplete option sequence preseeding '--vm'");
     494                        return errorSyntax(DHCPServer::tr("Incomplete option sequence preseeding '--vm'"));
    494495                    Scope.setMachineNIC(ValueUnion.psz);
    495496                    break;
     
    497498                case 'n':   // --nic        Sets the option scope to pszVmName + (ValueUnion.u8 - 1).
    498499                    if (Scope.getScope() != DHCPConfigScope_MachineNIC)
    499                         return errorSyntax("--nic option requires a --vm preceeding selecting the VM it should apply to");
     500                        return errorSyntax(DHCPServer::tr("--nic option requires a --vm preceeding selecting the VM it should apply to"));
    500501                    if (fNeedValueOrRemove)
    501                         return errorSyntax("Incomplete option sequence preseeding '--nic=%u", ValueUnion.u8);
     502                        return errorSyntax(DHCPServer::tr("Incomplete option sequence preseeding '--nic=%u"), ValueUnion.u8);
    502503                    if (ValueUnion.u8 < 1)
    503                         return errorSyntax("invalid NIC number: %u", ValueUnion.u8);
     504                        return errorSyntax(DHCPServer::tr("invalid NIC number: %u"), ValueUnion.u8);
    504505                    Scope.setMachineSlot(ValueUnion.u8 - 1);
    505506                    break;
     
    536537                                                 NULL, &cbRet);
    537538                    if (RT_FAILURE(vrc))
    538                         return errorArgument("Malformed hex string given to --set-opt-hex %u: %s\n", idAddOpt, ValueUnion.psz);
     539                        return errorArgument(DHCPServer::tr("Malformed hex string given to --set-opt-hex %u: %s\n"),
     540                                             idAddOpt, ValueUnion.psz);
    539541                    if (iPass == 1)
    540542                    {
     
    550552                case 'D':   // --del-opt num
    551553                    if (pCtx->pCmdDef->fSubcommandScope == HELP_SCOPE_DHCPSERVER_ADD)
    552                         return errorSyntax("--del-opt does not apply to the 'add' subcommand");
     554                        return errorSyntax(DHCPServer::tr("--del-opt does not apply to the 'add' subcommand"));
    553555                    if (iPass == 1)
    554556                    {
     
    562564                case DHCP_ADDMOD_UNFORCE_OPTION:    // --unforce-opt
    563565                    if (pCtx->pCmdDef->fSubcommandScope == HELP_SCOPE_DHCPSERVER_ADD)
    564                         return errorSyntax("--unforce-opt does not apply to the 'add' subcommand");
     566                        return errorSyntax(DHCPServer::tr("--unforce-opt does not apply to the 'add' subcommand"));
    565567                    RT_FALL_THROUGH();
    566568                case DHCP_ADDMOD_UNSUPPRESS_OPTION: // --unsupress-opt
    567569                    if (pCtx->pCmdDef->fSubcommandScope == HELP_SCOPE_DHCPSERVER_ADD)
    568                         return errorSyntax("--unsuppress-opt does not apply to the 'add' subcommand");
     570                        return errorSyntax(DHCPServer::tr("--unsuppress-opt does not apply to the 'add' subcommand"));
    569571                    RT_FALL_THROUGH();
    570572                case DHCP_ADDMOD_FORCE_OPTION:      // --force-opt
     
    624626                case DHCP_ADDMOD_ZAP_OPTIONS:
    625627                    if (pCtx->pCmdDef->fSubcommandScope == HELP_SCOPE_DHCPSERVER_ADD)
    626                         return errorSyntax("--zap-options does not apply to the 'add' subcommand");
     628                        return errorSyntax(DHCPServer::tr("--zap-options does not apply to the 'add' subcommand"));
    627629                    if (iPass == 1)
    628630                    {
     
    666668                case 'R':   // --remove-config
    667669                    if (pCtx->pCmdDef->fSubcommandScope == HELP_SCOPE_DHCPSERVER_ADD)
    668                         return errorSyntax("--remove-config does not apply to the 'add' subcommand");
     670                        return errorSyntax(DHCPServer::tr("--remove-config does not apply to the 'add' subcommand"));
    669671                    if (Scope.getScope() == DHCPConfigScope_Global)
    670                         return errorSyntax("--remove-config cannot be applied to the global config");
     672                        return errorSyntax(DHCPServer::tr("--remove-config cannot be applied to the global config"));
    671673                    if (iPass == 1)
    672674                    {
     
    681683                case 'f':   // --fixed-address
    682684                    if (Scope.getScope() != DHCPConfigScope_MachineNIC && Scope.getScope() != DHCPConfigScope_MAC)
    683                         return errorSyntax("--fixed-address can only be applied to a VM NIC or an MAC address");
     685                        return errorSyntax(DHCPServer::tr("--fixed-address can only be applied to a VM NIC or an MAC address"));
    684686                    if (iPass == 1)
    685687                    {
     
    715717                {
    716718                    if (Scope.getScope() != DHCPConfigScope_Group)
    717                         return errorSyntax("A group must be selected to perform condition alterations.");
     719                        return errorSyntax(DHCPServer::tr("A group must be selected to perform condition alterations."));
    718720                    if (!*ValueUnion.psz)
    719                         return errorSyntax("Condition value cannot be empty"); /* or can it? */
     721                        return errorSyntax(DHCPServer::tr("Condition value cannot be empty")); /* or can it? */
    720722                    if (iPass != 1)
    721723                        break;
     
    810812                            }
    811813                        if (!fFound)
    812                             rcExit = RTMsgErrorExitFailure("Could not find any condition of type %d with value '%s' to delete",
     814                            rcExit = RTMsgErrorExitFailure(DHCPServer::tr("Could not find any condition of type %d with value '%s' to delete"),
    813815                                                           enmType, ValueUnion.psz);
    814816                    }
     
    818820                case DHCP_ADDMOD_ZAP_CONDITIONS:
    819821                    if (Scope.getScope() != DHCPConfigScope_Group)
    820                         return errorSyntax("--zap-conditions can only be with a group selected");
     822                        return errorSyntax(DHCPServer::tr("--zap-conditions can only be with a group selected"));
    821823                    if (iPass == 1)
    822824                    {
     
    837839                case 'i':   // --id
    838840                    if (fNeedValueOrRemove)
    839                         return errorSyntax("Incomplete option sequence preseeding '--id=%u", ValueUnion.u8);
     841                        return errorSyntax(DHCPServer::tr("Incomplete option sequence preseeding '--id=%u"), ValueUnion.u8);
    840842                    u8OptId = ValueUnion.u8;
    841843                    fNeedValueOrRemove = true;
     
    844846                case 'p':   // --value
    845847                    if (!fNeedValueOrRemove)
    846                         return errorSyntax("--value without --id=dhcp-opt-no");
     848                        return errorSyntax(DHCPServer::tr("--value without --id=dhcp-opt-no"));
    847849                    if (iPass == 1)
    848850                    {
     
    858860                case 'r':   // --remove
    859861                    if (pCtx->pCmdDef->fSubcommandScope == HELP_SCOPE_DHCPSERVER_ADD)
    860                         return errorSyntax("--remove does not apply to the 'add' subcommand");
     862                        return errorSyntax(DHCPServer::tr("--remove does not apply to the 'add' subcommand"));
    861863                    if (!fNeedValueOrRemove)
    862                         return errorSyntax("--remove without --id=dhcp-opt-no");
     864                        return errorSyntax(DHCPServer::tr("--remove without --id=dhcp-opt-no"));
    863865
    864866                    if (iPass == 1)
     
    885887         */
    886888        if (!pCtx->pszNetwork && !pCtx->pszInterface)
    887             return errorSyntax("You need to specify either --network or --interface to identify the DHCP server");
     889            return errorSyntax(DHCPServer::tr("You need to specify either --network or --interface to identify the DHCP server"));
    888890
    889891        if (pCtx->pCmdDef->fSubcommandScope == HELP_SCOPE_DHCPSERVER_ADD)
    890892        {
    891893            if (!pszServerIp)
    892                 rcExit = errorSyntax("Missing required option: --ip");
     894                rcExit = errorSyntax(DHCPServer::tr("Missing required option: --ip"));
    893895            if (!pszNetmask)
    894                 rcExit = errorSyntax("Missing required option: --netmask");
     896                rcExit = errorSyntax(DHCPServer::tr("Missing required option: --netmask"));
    895897            if (!pszLowerIp)
    896                 rcExit = errorSyntax("Missing required option: --lowerip");
     898                rcExit = errorSyntax(DHCPServer::tr("Missing required option: --lowerip"));
    897899            if (!pszUpperIp)
    898                 rcExit = errorSyntax("Missing required option: --upperip");
     900                rcExit = errorSyntax(DHCPServer::tr("Missing required option: --upperip"));
    899901            if (rcExit != RTEXITCODE_SUCCESS)
    900902                return rcExit;
     
    914916            CHECK_ERROR(host, FindHostNetworkInterfaceByName(Bstr(pCtx->pszInterface).mutableRaw(), hif.asOutParam()));
    915917            if (FAILED(rc))
    916                 return errorArgument("Could not find interface '%s'", pCtx->pszInterface);
     918                return errorArgument(DHCPServer::tr("Could not find interface '%s'"), pCtx->pszInterface);
    917919
    918920            CHECK_ERROR(hif, COMGETTER(NetworkName) (NetName.asOutParam()));
    919921            if (FAILED(rc))
    920                 return errorArgument("Could not get network name for the interface '%s'", pCtx->pszInterface);
     922                return errorArgument(DHCPServer::tr("Could not get network name for the interface '%s'"), pCtx->pszInterface);
    921923        }
    922924        else
     
    929931        {
    930932            if (SUCCEEDED(rc))
    931                 return errorArgument("DHCP server already exists");
     933                return errorArgument(DHCPServer::tr("DHCP server already exists"));
    932934
    933935            CHECK_ERROR(pCtx->pArg->virtualBox, CreateDHCPServer(NetName.mutableRaw(), ptrDHCPServer.asOutParam()));
    934936            if (FAILED(rc))
    935                 return errorArgument("Failed to create the DHCP server");
     937                return errorArgument(DHCPServer::tr("Failed to create the DHCP server"));
    936938        }
    937939        else if (FAILED(rc))
    938             return errorArgument("DHCP server does not exist");
     940            return errorArgument(DHCPServer::tr("DHCP server does not exist"));
    939941
    940942        /*
     
    968970            CHECK_ERROR2_STMT(hrc, ptrDHCPServer, SetConfiguration(bstrServerIp.raw(), bstrNetmask.raw(),
    969971                                                                   bstrLowerIp.raw(), bstrUpperIp.raw()),
    970                               rcExit = errorArgument("Failed to set configuration (%ls, %ls, %ls, %ls)", bstrServerIp.raw(),
     972                              rcExit = errorArgument(DHCPServer::tr("Failed to set configuration (%ls, %ls, %ls, %ls)"), bstrServerIp.raw(),
    971973                                                     bstrNetmask.raw(), bstrLowerIp.raw(), bstrUpperIp.raw()));
    972974        }
     
    10201022        if (SUCCEEDED(hrc))
    10211023            return RTEXITCODE_SUCCESS;
    1022         errorArgument("Failed to remove server");
     1024        errorArgument(DHCPServer::tr("Failed to remove server"));
    10231025    }
    10241026    return RTEXITCODE_FAILURE;
     
    10871089        if (SUCCEEDED(hrc))
    10881090            return RTEXITCODE_SUCCESS;
    1089         errorArgument("Failed to start the server");
     1091        errorArgument(DHCPServer::tr("Failed to start the server"));
    10901092        GlueHandleComErrorNoCtx(ptrDHCPServer, hrc);
    10911093    }
     
    11311133        if (SUCCEEDED(hrc))
    11321134            return RTEXITCODE_SUCCESS;
    1133         errorArgument("Failed to restart the server");
     1135        errorArgument(DHCPServer::tr("Failed to restart the server"));
    11341136        GlueHandleComErrorNoCtx(ptrDHCPServer, hrc);
    11351137    }
     
    11751177        if (SUCCEEDED(hrc))
    11761178            return RTEXITCODE_SUCCESS;
    1177         errorArgument("Failed to stop the server");
     1179        errorArgument(DHCPServer::tr("Failed to stop the server"));
    11781180        GlueHandleComErrorNoCtx(ptrDHCPServer, hrc);
    11791181    }
     
    12221224
    12231225    if (!fHaveMacAddress)
    1224         return errorSyntax("You need to specify a MAC address too look for");
     1226        return errorSyntax(DHCPServer::tr("You need to specify a MAC address too look for"));
    12251227
    12261228    /*
     
    12501252        RTTimeToStringEx(RTTimeExplode(&Time, RTTimeSpecSetSeconds(&TimeSpec, secExpire)), szExpire, sizeof(szExpire), 0);
    12511253
    1252         RTPrintf("IP Address:  %ls\n"
    1253                  "MAC Address: %RTmac\n"
    1254                  "State:       %ls\n"
    1255                  "Issued:      %s (%RU64)\n"
    1256                  "Expire:      %s (%RU64)\n"
    1257                  "TTL:         %RU64 sec, currently %RU64 sec left\n",
     1254        RTPrintf(DHCPServer::tr("IP Address:  %ls\n"
     1255                                "MAC Address: %RTmac\n"
     1256                                "State:       %ls\n"
     1257                                "Issued:      %s (%RU64)\n"
     1258                                "Expire:      %s (%RU64)\n"
     1259                                "TTL:         %RU64 sec, currently %RU64 sec left\n"),
    12581260                 bstrAddress.raw(),
    12591261                 &MacAddress,
     
    13301332    return errorNoSubcommand();
    13311333}
    1332 
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette