VirtualBox

Changeset 90828 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 24, 2021 9:44:46 AM (3 years ago)
Author:
vboxsync
Message:

Main: bugref:1909: Added API localization

Location:
trunk/src/VBox/Main
Files:
3 added
107 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Makefile.kmk

    r88345 r90828  
    172172ifdef VBOX_WITH_EFI_IN_DD2
    173173 VBOX_MAIN_DEFS += VBOX_WITH_EFI_IN_DD2
     174endif
     175ifdef VBOX_WITH_MAIN_NLS
     176 VBOX_MAIN_DEFS += VBOX_WITH_MAIN_NLS
    174177endif
    175178# Unconditionally enable the new semaphore key generation code
     
    550553        src-all/PCIDeviceAttachmentImpl.cpp \
    551554        src-all/ProgressImpl.cpp \
    552         src-all/QMTranslatorImpl.cpp \
    553555        src-all/SecretKeyStore.cpp \
    554556        src-all/SharedFolderImpl.cpp \
     
    628630        $(if $(VBOX_WITH_XPCOM),src-server/xpcom/server.cpp,)
    629631
     632ifdef VBOX_WITH_MAIN_NLS
     633VBoxSVC_SOURCES += \
     634        src-all/VirtualBoxTranslator.cpp \
     635        src-all/QMTranslatorImpl.cpp
     636endif
     637
    630638ifn1of ($(KBUILD_TARGET), win darwin)
    631639VBoxSVC_SOURCES += $(PATH_ROOT)/src/VBox/Devices/Network/slirp/resolv_conf_parser.c
     
    10331041        $(VBOX_XML_SCHEMADEFS_CPP)
    10341042
     1043ifdef VBOX_WITH_MAIN_NLS
     1044VBoxC_SOURCES += \
     1045        src-all/VirtualBoxTranslator.cpp \
     1046        src-all/QMTranslatorImpl.cpp
     1047endif
     1048
    10351049# Experimental cloud support
    10361050ifdef VBOX_WITH_CLOUD_NET
     
    11511165        $(VBOX_AUTOGEN_EVENT_CPP) \
    11521166        $(VBOX_XML_SCHEMADEFS_CPP)
     1167 ifdef VBOX_WITH_MAIN_NLS
     1168 VBoxClient-x86_SOURCES += \
     1169        src-all/VirtualBoxTranslator.cpp \
     1170        src-all/QMTranslatorImpl.cpp
     1171 endif
    11531172 VBoxClient-x86_SOURCES.win = \
    11541173        src-client/win/dllmain.cpp \
     
    13901409
    13911410
     1411ifdef VBOX_WITH_MAIN_NLS
     1412#
     1413# NLS stuff.
     1414#
     1415PROGRAMS += VirtualBoxAPI
     1416VirtualBoxAPI_TEMPLATE = VBOXQTGUIEXE
     1417VirtualBoxAPI_INSTTYPE = none
     1418VirtualBoxAPI_LRCFLAGS = -silent
     1419VirtualBoxAPI_QT_TRANSLATIONS_INST = $(INST_BIN)nls/
     1420VirtualBoxAPI_APPROVED_LANGUAGES = \
     1421        bg \
     1422        ca \
     1423        ca_VA \
     1424        cs \
     1425        da \
     1426        de \
     1427        el \
     1428        en \
     1429        es \
     1430        eu \
     1431        fa \
     1432        fi \
     1433        fr \
     1434        gl \
     1435        he \
     1436        hr_HR \
     1437        hu \
     1438        id \
     1439        it \
     1440        ja \
     1441        km_KH \
     1442        ko \
     1443        lt \
     1444        nl \
     1445        pl \
     1446        pt \
     1447        pt_BR \
     1448        ro \
     1449        ru \
     1450        sk \
     1451        sl \
     1452        sr \
     1453        sv \
     1454        th \
     1455        tr \
     1456        uk \
     1457        zh_CN \
     1458        zh_TW
     1459
     1460VirtualBoxAPI_QT_TRANSLATIONS = \
     1461        $(filter \
     1462                $(addsuffix .ts, $(addprefix $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_, \
     1463                        $(VirtualBoxAPI_APPROVED_LANGUAGES))), \
     1464                $(wildcard $(VBOX_PATH_MAIN_SRC)/nls/*.ts))
     1465
     1466VirtualBoxAPI_SOURCES = \
     1467        nls/dummy.c
     1468VirtualBoxAPI_VBOX_ALL_NLS_SOURCES = $(wildcard \
     1469        $(VBOX_PATH_MAIN_SRC)/include/*.h\
     1470        $(VBOX_PATH_MAIN_SRC)/src-all/*.cpp \
     1471        $(VBOX_PATH_MAIN_SRC)/src-all/*.h \
     1472        $(VBOX_PATH_MAIN_SRC)/src-server/*.cpp \
     1473        $(VBOX_PATH_MAIN_SRC)/src-server/*.h \
     1474        $(VBOX_PATH_MAIN_SRC)/src-client/*.cpp \
     1475        $(VBOX_PATH_MAIN_SRC)/src-client/*.h )
     1476
     1477updatenls:: makeallnls $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_en.ts
     1478
     1479makeallnls:: $(VirtualBoxAPI_VBOX_ALL_NLS_SOURCES)
     1480        $(call MSG_L1,lupdate all languages (nls/*.ts))
     1481        $(QUIET)$(TOOL_QT5_LUPDATE) \
     1482                $^ \
     1483                -ts \
     1484                $(filter-out nls/VirtualBoxAPI_en.ts, $(VirtualBoxAPI_QT_TRANSLATIONS)) \
     1485                $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_xx_YY.ts
     1486
     1487fake-main-nls:
     1488        $(foreach file, $(VirtualBoxAPI_QT_TRANSLATIONS) \
     1489        ,$(NLTAB)$(SED) -i \
     1490        -e '/<source>.*<\/source>/h' \
     1491        -e '/<source>.*<\/source>/p' \
     1492        -e '/<translation type="unfinished"><\/translation>/{' \
     1493                -e 'x' \
     1494                -e 's/<source>\(.*\)<\/source>/<translation type="unfinished">$(notdir $(file)): \1<\/translation>/' \
     1495        -e '}' \
     1496                $(file) )
     1497
     1498
     1499# Create the English translation file. This is something special cause it will
     1500# contain the plural forms only.
     1501$(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_en.ts: $(VirtualBoxAPI_VBOX_ALL_NLS_SOURCES)
     1502        $(call MSG_L1,lupdate $@)
     1503        $(QUIET)$(TOOL_QT5_LUPDATE) \
     1504                $^ \
     1505                -ts \
     1506                "$@"
     1507        $(QUIET)$(SED) -n -i \
     1508                -e '/<context>/,/<\/context>/!p' \
     1509                -e '/<context>/h'  \
     1510                -e '/<name>/H' \
     1511                -e '/<message numerus="yes">/,/<\/message>/H' \
     1512                -e '/<\/context>/{H;x;/<message/p}' \
     1513                "$@"
     1514
     1515endif # VBOX_WITH_MAIN_NLS
     1516
    13921517
    13931518# generate rules
     
    17371862        $(VBoxAPIWrap_0_OUTDIR)/apiwrappers-sources-even
    17381863
    1739 
    1740 #
    1741 # NLS stuff.
    1742 #
    1743 updatenls::
    1744         $(VBOX_LUPDATE) $(VBoxSVC_SOURCES) $(VBoxSVC_VBOX_HEADERS) -ts $(VBoxSVC_VBOX_TRANSLATIONS)
    1745         $(VBOX_LUPDATE) $(VBoxC_SOURCES) $(VBoxC_VBOX_HEADERS) -ts $(VBoxC_VBOX_TRANSLATIONS)
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r90799 r90828  
    1178111781    </attribute>
    1178211782
     11783    <attribute name="languageId" type="wstring">
     11784      <desc>
     11785        The API language ID used to translate messages to client.
     11786      </desc>
     11787    </attribute>
     11788
    1178311789    <method name="getMaxNetworkAdapters">
    1178411790      <desc>
     
    2494224948      </desc>
    2494324949    </const>
     24950    <const name="OnLanguageChanged" value="111">
     24951      <desc>
     24952        See <link to="ILanguageChangedEvent"/>.
     24953      </desc>
     24954    </const>
    2494424955    <!-- End event marker -->
    2494524956    <!-- @todo rename to 'End' as it is exclusive (we use 'last' to be inclusive). -->
    24946     <const name="Last" value="111">
     24957    <const name="Last" value="112">
    2494724958      <desc>
    2494824959        Must be last event, used for iterations and structures relying on numerical event values.
     
    2845428465  </interface>
    2845528466
     28467  <interface name="ILanguageChangedEvent" extends="IEvent"
     28468    uuid="28935887-782b-4c94-8410-ce557b9cfe44"
     28469    wsmap="managed" autogen="VBoxEvent"
     28470    id="OnLanguageChanged"
     28471    >
     28472    <attribute name="languageId" type="wstring" readonly="yes"/>
     28473  </interface>
    2845628474
    2845728475  <module name="VBoxSVC" context="LocalServer">
  • trunk/src/VBox/Main/idl/apiwrap-server.xsl

    r85421 r90828  
    171171
    172172</xsl:text>
    173     <xsl:value-of select="concat('    DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
     173    <xsl:value-of select="concat('    DECLARE_COMMON_CLASS_METHODS(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
    174174</xsl:template>
    175175
  • trunk/src/VBox/Main/include/AdditionsFacilityImpl.h

    r84564 r90828  
    3535public:
    3636
    37     DECLARE_EMPTY_CTOR_DTOR(AdditionsFacility)
     37    DECLARE_COMMON_CLASS_METHODS(AdditionsFacility)
    3838
    3939    /** @name Initializer & uninitializer methods
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r90424 r90828  
    6868public:
    6969
    70     DECLARE_EMPTY_CTOR_DTOR(Appliance)
     70    DECLARE_COMMON_CLASS_METHODS(Appliance)
    7171
    7272    HRESULT FinalConstruct();
     
    7979    /* public methods only for internal purposes */
    8080
    81     static HRESULT i_setErrorStatic(HRESULT aResultCode,
    82                                     const Utf8Str &aText)
     81    static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *aText, ...)
    8382    {
    84         return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
     83        va_list va;
     84        va_start(va, aText);
     85        HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true);
     86        va_end(va);
     87        return hrc;
    8588    }
    8689
     
    289292public:
    290293
    291     DECLARE_EMPTY_CTOR_DTOR(VirtualSystemDescription)
     294    DECLARE_COMMON_CLASS_METHODS(VirtualSystemDescription)
    292295
    293296    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/AudioAdapterImpl.h

    r82968 r90828  
    3535public:
    3636
    37     DECLARE_EMPTY_CTOR_DTOR (AudioAdapter)
     37    DECLARE_COMMON_CLASS_METHODS (AudioAdapter)
    3838
    3939    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/BIOSSettingsImpl.h

    r82968 r90828  
    3838public:
    3939
    40     DECLARE_EMPTY_CTOR_DTOR(BIOSSettings)
     40    DECLARE_COMMON_CLASS_METHODS(BIOSSettings)
    4141
    4242    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/BandwidthControlImpl.h

    r82968 r90828  
    3737public:
    3838
    39     DECLARE_EMPTY_CTOR_DTOR(BandwidthControl)
     39    DECLARE_COMMON_CLASS_METHODS(BandwidthControl)
    4040
    4141    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/BandwidthGroupImpl.h

    r85242 r90828  
    3333public:
    3434
    35     DECLARE_EMPTY_CTOR_DTOR(BandwidthGroup)
     35    DECLARE_COMMON_CLASS_METHODS(BandwidthGroup)
    3636
    3737    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/CPUProfileImpl.h

    r85574 r90828  
    3535    /** @name COM and internal init/term/mapping cruft
    3636     * @{ */
    37     DECLARE_EMPTY_CTOR_DTOR(CPUProfile)
     37    DECLARE_COMMON_CLASS_METHODS(CPUProfile)
    3838    HRESULT FinalConstruct();
    3939    void    FinalRelease();
  • trunk/src/VBox/Main/include/CertificateImpl.h

    r82968 r90828  
    5151public:
    5252
    53     DECLARE_EMPTY_CTOR_DTOR(Certificate)
     53    DECLARE_COMMON_CLASS_METHODS(Certificate)
    5454
    5555    HRESULT initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted, bool a_fExpired);
  • trunk/src/VBox/Main/include/CloudNetworkImpl.h

    r85360 r90828  
    3434public:
    3535
    36     DECLARE_EMPTY_CTOR_DTOR(CloudNetwork)
     36    DECLARE_COMMON_CLASS_METHODS(CloudNetwork)
    3737
    3838    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r90187 r90828  
    128128public:
    129129
    130     DECLARE_EMPTY_CTOR_DTOR(Console)
     130    DECLARE_COMMON_CLASS_METHODS(Console)
    131131
    132132    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/ConsoleVRDPServer.h

    r88253 r90828  
    6161
    6262/* Member of Console. Helper class for VRDP server management. Not a COM class. */
    63 class ConsoleVRDPServer
     63class ConsoleVRDPServer : public VirtualBoxTranslatable
    6464{
    6565public:
     66    DECLARE_TRANSLATE_METHODS(ConsoleVRDPServer)
     67
    6668    ConsoleVRDPServer (Console *console);
    6769    ~ConsoleVRDPServer ();
     
    379381    DECLARE_NOT_AGGREGATABLE(VRDEServerInfo)
    380382
    381     DECLARE_EMPTY_CTOR_DTOR(VRDEServerInfo)
     383    DECLARE_COMMON_CLASS_METHODS(VRDEServerInfo)
    382384
    383385    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/DHCPConfigImpl.h

    r82968 r90828  
    4141 * can call setError and such on.
    4242 */
    43 class DHCPConfig
     43class DHCPConfig : public VirtualBoxTranslatable
    4444{
    4545protected:
     
    9898
    9999public:
     100    DECLARE_TRANSLATE_METHODS(DHCPConfig)
     101
    100102    /** @name IDHCPConfig methods
    101103     * @note public because the DHCPServer needs them for 6.0 interfaces.
     
    127129{
    128130public:
     131    DECLARE_TRANSLATE_METHODS(DHCPGlobalConfig)
     132
    129133    /** @name Constructors and destructors.
    130134     * @{ */
     
    224228
    225229public:
     230    DECLARE_TRANSLATE_METHODS(DHCPGroupCondition)
     231
    226232    /** @name Constructors and destructors.
    227233     * @{ */
     
    288294
    289295public:
     296    DECLARE_TRANSLATE_METHODS(DHCPGroupConfig)
     297
    290298    /** @name Constructors and destructors.
    291299     * @{ */
     
    400408
    401409public:
     410    DECLARE_TRANSLATE_METHODS(DHCPIndividualConfig)
     411
    402412    /** @name Constructors and destructors.
    403413     * @{ */
  • trunk/src/VBox/Main/include/DHCPServerImpl.h

    r85235 r90828  
    5757    /** @name Constructors and destructors
    5858     * @{ */
    59     DECLARE_EMPTY_CTOR_DTOR(DHCPServer)
     59    DECLARE_COMMON_CLASS_METHODS(DHCPServer)
    6060    HRESULT FinalConstruct();
    6161    void    FinalRelease();
  • trunk/src/VBox/Main/include/DataStreamImpl.h

    r82968 r90828  
    3131{
    3232public:
    33     DECLARE_EMPTY_CTOR_DTOR(DataStream)
     33    DECLARE_COMMON_CLASS_METHODS(DataStream)
    3434
    3535    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r90691 r90828  
    138138public:
    139139
    140     DECLARE_EMPTY_CTOR_DTOR(Display)
     140    DECLARE_COMMON_CLASS_METHODS(Display)
    141141
    142142    HRESULT FinalConstruct();
     
    457457public:
    458458
    459     DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
     459    DECLARE_COMMON_CLASS_METHODS(DisplaySourceBitmap)
    460460
    461461    HRESULT FinalConstruct();
     
    506506public:
    507507
    508     DECLARE_EMPTY_CTOR_DTOR(GuestScreenInfo)
     508    DECLARE_COMMON_CLASS_METHODS(GuestScreenInfo)
    509509
    510510    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/EmulatedUSBImpl.h

    r82968 r90828  
    3434public:
    3535
    36     DECLARE_EMPTY_CTOR_DTOR(EmulatedUSB)
     36    DECLARE_COMMON_CLASS_METHODS(EmulatedUSB)
    3737
    3838    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/EventImpl.h

    r85293 r90828  
    3131{
    3232public:
    33     DECLARE_EMPTY_CTOR_DTOR(VBoxEvent)
     33    DECLARE_COMMON_CLASS_METHODS(VBoxEvent)
    3434
    3535    HRESULT FinalConstruct();
     
    5959{
    6060public:
    61     DECLARE_EMPTY_CTOR_DTOR(VBoxVetoEvent)
     61    DECLARE_COMMON_CLASS_METHODS(VBoxVetoEvent)
    6262
    6363    HRESULT FinalConstruct();
     
    9494{
    9595public:
    96     DECLARE_EMPTY_CTOR_DTOR(EventSource)
     96    DECLARE_COMMON_CLASS_METHODS(EventSource)
    9797
    9898    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/ExtPackManagerImpl.h

    r86058 r90828  
    4444    /** @name COM and internal init/term/mapping cruft.
    4545     * @{ */
    46     DECLARE_EMPTY_CTOR_DTOR(ExtPackFile)
     46    DECLARE_COMMON_CLASS_METHODS(ExtPackFile)
    4747
    4848    HRESULT     FinalConstruct();
     
    102102    /** @name COM and internal init/term/mapping cruft.
    103103     * @{ */
    104     DECLARE_EMPTY_CTOR_DTOR(ExtPack)
     104    DECLARE_COMMON_CLASS_METHODS(ExtPack)
    105105
    106106    HRESULT     FinalConstruct();
     
    226226    /** @name COM and internal init/term/mapping cruft.
    227227     * @{ */
    228     DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
     228    DECLARE_COMMON_CLASS_METHODS(ExtPackManager)
    229229
    230230    HRESULT     FinalConstruct();
  • trunk/src/VBox/Main/include/GraphicsAdapterImpl.h

    r82968 r90828  
    3636public:
    3737
    38     DECLARE_EMPTY_CTOR_DTOR(GraphicsAdapter)
     38    DECLARE_COMMON_CLASS_METHODS(GraphicsAdapter)
    3939
    4040    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/GuestDirectoryImpl.h

    r84648 r90828  
    3838    /** @name COM and internal init/term/mapping cruft.
    3939     * @{ */
    40     DECLARE_EMPTY_CTOR_DTOR(GuestDirectory)
     40    DECLARE_COMMON_CLASS_METHODS(GuestDirectory)
    4141
    4242    int     init(Console *pConsole, GuestSession *pSession, ULONG aObjectID, const GuestDirectoryOpenInfo &openInfo);
  • trunk/src/VBox/Main/include/GuestDnDPrivate.h

    r86530 r90828  
    800800 * Class for keeping a DnD guest state around.
    801801 */
    802 class GuestDnDState
    803 {
    804 
    805 public:
     802class GuestDnDState : public VirtualBoxTranslatable
     803{
     804
     805public:
     806    DECLARE_TRANSLATE_METHODS(GuestDnDState)
    806807
    807808    GuestDnDState(const ComObjPtr<Guest>& pGuest);
  • trunk/src/VBox/Main/include/GuestDnDSourceImpl.h

    r85743 r90828  
    4040    /** @name COM and internal init/term/mapping cruft.
    4141     * @{ */
    42     DECLARE_EMPTY_CTOR_DTOR(GuestDnDSource)
     42    DECLARE_COMMON_CLASS_METHODS(GuestDnDSource)
    4343
    4444    HRESULT init(const ComObjPtr<Guest>& pGuest);
  • trunk/src/VBox/Main/include/GuestDnDTargetImpl.h

    r85743 r90828  
    3838    /** @name COM and internal init/term/mapping cruft.
    3939     * @{ */
    40     DECLARE_EMPTY_CTOR_DTOR(GuestDnDTarget)
     40    DECLARE_COMMON_CLASS_METHODS(GuestDnDTarget)
    4141
    4242    HRESULT init(const ComObjPtr<Guest>& pGuest);
  • trunk/src/VBox/Main/include/GuestFileImpl.h

    r84648 r90828  
    3939    /** @name COM and internal init/term/mapping cruft.
    4040     * @{ */
    41     DECLARE_EMPTY_CTOR_DTOR(GuestFile)
     41    DECLARE_COMMON_CLASS_METHODS(GuestFile)
    4242
    4343    int     init(Console *pConsole, GuestSession *pSession, ULONG uFileID, const GuestFileOpenInfo &openInfo);
  • trunk/src/VBox/Main/include/GuestFsObjInfoImpl.h

    r82968 r90828  
    3131    /** @name COM and internal init/term/mapping cruft.
    3232     * @{ */
    33     DECLARE_EMPTY_CTOR_DTOR(GuestFsObjInfo)
     33    DECLARE_COMMON_CLASS_METHODS(GuestFsObjInfo)
    3434
    3535    int     init(const GuestFsObjData &objData);
  • trunk/src/VBox/Main/include/GuestImpl.h

    r85309 r90828  
    6363public:
    6464
    65     DECLARE_EMPTY_CTOR_DTOR (Guest)
     65    DECLARE_COMMON_CLASS_METHODS (Guest)
    6666
    6767    HRESULT FinalConstruct();
     
    101101    BOOL i_isPageFusionEnabled();
    102102    void i_setCpuCount(uint32_t aCpus) { mCpus = aCpus; }
    103     static HRESULT i_setErrorStatic(HRESULT aResultCode, const Utf8Str &aText)
     103    static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *aText, ...)
    104104    {
    105         return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
     105        va_list va;
     106        va_start(va, aText);
     107        HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true);
     108        va_end(va);
     109        return hrc;
    106110    }
    107111    uint32_t    i_getAdditionsRevision(void) { return mData.mAdditionsRevision; }
  • trunk/src/VBox/Main/include/GuestOSTypeImpl.h

    r87241 r90828  
    3131public:
    3232
    33     DECLARE_EMPTY_CTOR_DTOR(GuestOSType)
     33    DECLARE_COMMON_CLASS_METHODS(GuestOSType)
    3434
    3535    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/GuestProcessImpl.h

    r84648 r90828  
    4141    /** @name COM and internal init/term/mapping cruft.
    4242     * @{ */
    43     DECLARE_EMPTY_CTOR_DTOR(GuestProcess)
     43    DECLARE_COMMON_CLASS_METHODS(GuestProcess)
    4444
    4545    int     init(Console *aConsole, GuestSession *aSession, ULONG aObjectID,
     
    214214 * information extraction and maintaining the overall status.
    215215 */
    216 class GuestProcessTool
     216class GuestProcessTool : public VirtualBoxTranslatable
    217217{
    218218public:
     219    DECLARE_TRANSLATE_METHODS(GuestProcessTool)
    219220
    220221    GuestProcessTool(void);
  • trunk/src/VBox/Main/include/GuestSessionImpl.h

    r84648 r90828  
    4848    /** @name COM and internal init/term/mapping cruft.
    4949     * @{ */
    50     DECLARE_EMPTY_CTOR_DTOR(GuestSession)
     50    DECLARE_COMMON_CLASS_METHODS(GuestSession)
    5151
    5252    int     init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds);
  • trunk/src/VBox/Main/include/GuestSessionImplTasks.h

    r84648 r90828  
    154154 * runs in a Main worker thread.
    155155 */
    156 class GuestSessionTask : public ThreadTask
    157 {
    158 public:
     156class GuestSessionTask
     157    : public ThreadTask
     158    , public VirtualBoxTranslatable
     159{
     160public:
     161    DECLARE_TRANSLATE_METHODS(GuestSessionTask)
    159162
    160163    GuestSessionTask(GuestSession *pSession);
     
    270273{
    271274public:
     275    DECLARE_TRANSLATE_METHODS(GuestSessionCopyTask)
    272276
    273277    GuestSessionCopyTask(GuestSession *pSession);
     
    291295{
    292296public:
     297    DECLARE_TRANSLATE_METHODS(GuestSessionTaskCopyFrom)
    293298
    294299    GuestSessionTaskCopyFrom(GuestSession *pSession, GuestSessionFsSourceSet const &vecSrc, const Utf8Str &strDest);
     
    305310{
    306311public:
     312    DECLARE_TRANSLATE_METHODS(GuestSessionTaskCopyTo)
    307313
    308314    GuestSessionTaskCopyTo(GuestSession *pSession, GuestSessionFsSourceSet const &vecSrc, const Utf8Str &strDest);
     
    319325{
    320326public:
     327    DECLARE_TRANSLATE_METHODS(GuestSessionTaskUpdateAdditions)
    321328
    322329    GuestSessionTaskUpdateAdditions(GuestSession *pSession, const Utf8Str &strSource,
  • trunk/src/VBox/Main/include/HostDriveImpl.h

    r85935 r90828  
    2828{
    2929public:
    30     DECLARE_EMPTY_CTOR_DTOR(HostDrive)
     30    DECLARE_COMMON_CLASS_METHODS(HostDrive)
    3131
    3232    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/HostDrivePartitionImpl.h

    r85933 r90828  
    3030{
    3131public:
    32     DECLARE_EMPTY_CTOR_DTOR(HostDrivePartition)
     32    DECLARE_COMMON_CLASS_METHODS(HostDrivePartition)
    3333
    3434    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/HostImpl.h

    r86331 r90828  
    4444public:
    4545
    46     DECLARE_EMPTY_CTOR_DTOR(Host)
     46    DECLARE_COMMON_CLASS_METHODS(Host)
    4747
    4848    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h

    r82968 r90828  
    3737public:
    3838
    39     DECLARE_EMPTY_CTOR_DTOR(HostNetworkInterface)
     39    DECLARE_COMMON_CLASS_METHODS(HostNetworkInterface)
    4040
    4141    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/HostUSBDeviceImpl.h

    r82968 r90828  
    172172{
    173173public:
    174     DECLARE_EMPTY_CTOR_DTOR(HostUSBDevice)
     174    DECLARE_COMMON_CLASS_METHODS(HostUSBDevice)
    175175
    176176    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/HostUpdateImpl.h

    r86530 r90828  
    3030{
    3131public:
    32     DECLARE_EMPTY_CTOR_DTOR(HostUpdate)
     32    DECLARE_COMMON_CLASS_METHODS(HostUpdate)
    3333
    3434    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/HostVideoInputDeviceImpl.h

    r82968 r90828  
    3535public:
    3636
    37     DECLARE_EMPTY_CTOR_DTOR(HostVideoInputDevice)
     37    DECLARE_COMMON_CLASS_METHODS(HostVideoInputDevice)
    3838
    3939    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/KeyboardImpl.h

    r82968 r90828  
    4949public:
    5050
    51     DECLARE_EMPTY_CTOR_DTOR(Keyboard)
     51    DECLARE_COMMON_CLASS_METHODS(Keyboard)
    5252
    5353    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/MachineDebuggerImpl.h

    r89696 r90828  
    3535public:
    3636
    37     DECLARE_EMPTY_CTOR_DTOR (MachineDebugger)
     37    DECLARE_COMMON_CLASS_METHODS (MachineDebugger)
    3838
    3939    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/MachineImpl.h

    r87241 r90828  
    338338    typedef std::list<ComObjPtr<MediumAttachment> > MediumAttachmentList;
    339339
    340     DECLARE_EMPTY_CTOR_DTOR(Machine)
     340    DECLARE_COMMON_CLASS_METHODS(Machine)
    341341
    342342    HRESULT FinalConstruct();
     
    12791279    END_COM_MAP()
    12801280
    1281     DECLARE_EMPTY_CTOR_DTOR(SessionMachine)
     1281    DECLARE_COMMON_CLASS_METHODS(SessionMachine)
    12821282
    12831283    HRESULT FinalConstruct();
     
    15341534    END_COM_MAP()
    15351535
    1536     DECLARE_EMPTY_CTOR_DTOR(SnapshotMachine)
     1536    DECLARE_COMMON_CLASS_METHODS(SnapshotMachine)
    15371537
    15381538    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/MachineImplCloneVM.h

    r82968 r90828  
    2828struct MachineCloneVMPrivate;
    2929
    30 class MachineCloneVM
     30class MachineCloneVM : public VirtualBoxTranslatable
    3131{
    3232public:
     33    DECLARE_TRANSLATE_METHODS(MachineCloneVM)
     34
    3335    MachineCloneVM(ComObjPtr<Machine> pSrcMachine, ComObjPtr<Machine> pTrgMachine, CloneMode_T mode, const RTCList<CloneOptions_T> &opts);
    3436    ~MachineCloneVM();
  • trunk/src/VBox/Main/include/MachineImplMoveVM.h

    r82968 r90828  
    6464struct fileList_t;
    6565
    66 class MachineMoveVM : public ThreadTask
     66class MachineMoveVM : public ThreadTask, public VirtualBoxTranslatable
    6767{
    6868    std::vector<ComObjPtr<Machine> >        machineList;
     
    8383
    8484public:
     85    DECLARE_TRANSLATE_METHODS(MachineMoveVM)
     86
    8587    MachineMoveVM(ComObjPtr<Machine> aMachine,
    8688                  const com::Utf8Str &aTargetPath,
  • trunk/src/VBox/Main/include/MediumAttachmentImpl.h

    r82968 r90828  
    3030public:
    3131
    32     DECLARE_EMPTY_CTOR_DTOR(MediumAttachment)
     32    DECLARE_COMMON_CLASS_METHODS(MediumAttachment)
    3333
    3434    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/MediumFormatImpl.h

    r82968 r90828  
    5353    typedef std::vector<com::Utf8Str> StrArray;
    5454
    55     DECLARE_EMPTY_CTOR_DTOR(MediumFormat)
     55    DECLARE_COMMON_CLASS_METHODS(MediumFormat)
    5656
    5757    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/MediumIOImpl.h

    r82968 r90828  
    3232    /** @name Dummy/standard constructors and destructors.
    3333     * @{ */
    34     DECLARE_EMPTY_CTOR_DTOR(MediumIO)
     34    DECLARE_COMMON_CLASS_METHODS(MediumIO)
    3535    HRESULT FinalConstruct();
    3636    void    FinalRelease();
  • trunk/src/VBox/Main/include/MediumImpl.h

    r86501 r90828  
    4646{
    4747public:
    48     DECLARE_EMPTY_CTOR_DTOR(Medium)
     48    DECLARE_COMMON_CLASS_METHODS(Medium)
    4949
    5050    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/MouseImpl.h

    r82968 r90828  
    3737public:
    3838
    39     DECLARE_EMPTY_CTOR_DTOR (Mouse)
     39    DECLARE_COMMON_CLASS_METHODS (Mouse)
    4040
    4141    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/NATEngineImpl.h

    r82968 r90828  
    3737public:
    3838
    39     DECLARE_EMPTY_CTOR_DTOR(NATEngine)
     39    DECLARE_COMMON_CLASS_METHODS(NATEngine)
    4040
    4141    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/NATNetworkImpl.h

    r87949 r90828  
    6464public:
    6565
    66     DECLARE_EMPTY_CTOR_DTOR(NATNetwork)
     66    DECLARE_COMMON_CLASS_METHODS(NATNetwork)
    6767
    6868    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/NetworkAdapterImpl.h

    r82968 r90828  
    3939public:
    4040
    41     DECLARE_EMPTY_CTOR_DTOR(NetworkAdapter)
     41    DECLARE_COMMON_CLASS_METHODS(NetworkAdapter)
    4242
    4343    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/PCIDeviceAttachmentImpl.h

    r82968 r90828  
    3636public:
    3737
    38     DECLARE_EMPTY_CTOR_DTOR(PCIDeviceAttachment)
     38    DECLARE_COMMON_CLASS_METHODS(PCIDeviceAttachment)
    3939
    4040    // public initializer/uninitializer for internal purposes only
  • trunk/src/VBox/Main/include/ParallelPortImpl.h

    r82968 r90828  
    3535public:
    3636
    37     DECLARE_EMPTY_CTOR_DTOR(ParallelPort)
     37    DECLARE_COMMON_CLASS_METHODS(ParallelPort)
    3838
    3939    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/PerformanceImpl.h

    r82968 r90828  
    5555public:
    5656
    57     DECLARE_EMPTY_CTOR_DTOR(PerformanceMetric)
     57    DECLARE_COMMON_CLASS_METHODS(PerformanceMetric)
    5858
    5959    HRESULT FinalConstruct();
     
    104104public:
    105105
    106     DECLARE_EMPTY_CTOR_DTOR(PerformanceCollector)
     106    DECLARE_COMMON_CLASS_METHODS(PerformanceCollector)
    107107
    108108    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/ProgressImpl.h

    r86650 r90828  
    158158
    159159protected:
    160     DECLARE_EMPTY_CTOR_DTOR(Progress)
     160    DECLARE_COMMON_CLASS_METHODS(Progress)
    161161
    162162#if !defined(VBOX_COM_INPROC)
  • trunk/src/VBox/Main/include/QMTranslator.h

    r82968 r90828  
    3030    virtual ~QMTranslator();
    3131
    32     /* Gets translation from loaded QM file
     32    /**
     33     * Gets translation from loaded QM file
    3334     *
    34      * @param   context   QM context to look for translation
    35      * @param   source    Source string in one-byte encoding
    36      * @param   disamb    Disambiguationg comment, empty by default
     35     * @param   pszContext  QM context to look for translation
     36     * @param   pszSource   Source string in one-byte encoding
     37     * @param   pszDisamb   Disambiguationg comment, empty by default
     38     * @param   iNum        Plural form indicator.
    3739     *
    38      * @returns Pointer to a translation in UTF-8 encoding, empty string on failure */
     40     * @returns Pointer to a translation (UTF-8 encoding), source string on failure.
     41     */
     42    const char *translate(const char *pszContext, const char *pszSource,
     43                          const char *pszDisamb = NULL, const int iNum = -1) const RT_NOEXCEPT;
    3944
    40     const char *translate(const char *pszContext, const char *pszSource, const char *pszDisamb = "") const throw();
    41 
    42     /* Loads and parses QM file
     45    /**
     46     * Loads and parses QM file
    4347     *
    44      * @param       filename    The name of the file to load
     48     * @param   pszFilename The name of the file to load
     49     * @param   hStrCache   The string cache to use for storing strings.
    4550     *
    46      * @returns VINF_SUCCESS if successful */
    47     int load(const char *pszFilename) throw();
     51     * @returns VBox status code.
     52     */
     53    int load(const char *pszFilename, RTSTRCACHE hStrCache) RT_NOEXCEPT;
    4854
    4955private:
    50         /* QMTranslator implementation.
    51          * To separate all the code from the interface */
    52     QMTranslator_Impl *_impl;
     56    /** QMTranslator implementation.
     57     * To separate all the code from the interface */
     58    QMTranslator_Impl *m_impl;
    5359
    5460    /* If copying is required, please define the following operators */
  • trunk/src/VBox/Main/include/RecordingScreenSettingsImpl.h

    r82968 r90828  
    3838public:
    3939
    40     DECLARE_EMPTY_CTOR_DTOR(RecordingScreenSettings)
     40    DECLARE_COMMON_CLASS_METHODS(RecordingScreenSettings)
    4141
    4242    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/RecordingSettingsImpl.h

    r82968 r90828  
    3737public:
    3838
    39     DECLARE_EMPTY_CTOR_DTOR(RecordingSettings)
     39    DECLARE_COMMON_CLASS_METHODS(RecordingSettings)
    4040
    4141    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h

    r82968 r90828  
    3535public:
    3636
    37     DECLARE_EMPTY_CTOR_DTOR(RemoteUSBDevice)
     37    DECLARE_COMMON_CLASS_METHODS(RemoteUSBDevice)
    3838
    3939    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/SerialPortImpl.h

    r82968 r90828  
    3838public:
    3939
    40     DECLARE_EMPTY_CTOR_DTOR(SerialPort)
     40    DECLARE_COMMON_CLASS_METHODS(SerialPort)
    4141
    4242    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/SessionImpl.h

    r84411 r90828  
    4747    DECLARE_NOT_AGGREGATABLE(Session)
    4848
    49     DECLARE_EMPTY_CTOR_DTOR(Session)
     49    DECLARE_COMMON_CLASS_METHODS(Session)
    5050
    5151    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/SharedFolderImpl.h

    r82968 r90828  
    3232public:
    3333
    34     DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
     34    DECLARE_COMMON_CLASS_METHODS (SharedFolder)
    3535
    3636    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/SnapshotImpl.h

    r82968 r90828  
    3535{
    3636public:
    37     DECLARE_EMPTY_CTOR_DTOR(Snapshot)
     37    DECLARE_COMMON_CLASS_METHODS(Snapshot)
    3838
    3939    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/StorageControllerImpl.h

    r82968 r90828  
    3030public:
    3131
    32     DECLARE_EMPTY_CTOR_DTOR(StorageController)
     32    DECLARE_COMMON_CLASS_METHODS(StorageController)
    3333
    3434    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/SystemPropertiesImpl.h

    r87241 r90828  
    4141    typedef std::list<ComObjPtr<CPUProfile> > CPUProfileList_T;
    4242
    43     DECLARE_EMPTY_CTOR_DTOR(SystemProperties)
     43    DECLARE_COMMON_CLASS_METHODS(SystemProperties)
    4444
    4545    HRESULT FinalConstruct();
     
    154154    HRESULT getVBoxUpdateCount(ULONG *aVBoxUpdateCount) RT_OVERRIDE;
    155155    HRESULT setVBoxUpdateCount(ULONG aVBoxUpdateCount) RT_OVERRIDE;
     156    HRESULT getLanguageId(com::Utf8Str &aLanguageId) RT_OVERRIDE;
     157    HRESULT setLanguageId(const com::Utf8Str &aLanguageId) RT_OVERRIDE;
    156158
    157159    // wrapped ISystemProperties methods
  • trunk/src/VBox/Main/include/TextScript.h

    r82968 r90828  
    3232 * @todo get rid of this silly bugger.
    3333 */
    34 class AbstractScript : public RTCNonCopyable
     34class AbstractScript
     35    : public RTCNonCopyable
     36    , public VirtualBoxTranslatable
    3537{
    3638protected:
     
    4345
    4446public:
     47    DECLARE_TRANSLATE_METHODS(AbstractScript)
     48
    4549    AbstractScript(VirtualBoxBase *pSetError) : mpSetError(pSetError) {}
    4650    virtual ~AbstractScript() {}
     
    101105
    102106public:
     107    DECLARE_TRANSLATE_METHODS(BaseTextScript)
     108
    103109    BaseTextScript(VirtualBoxBase *pSetError, const char *pszDefaultTemplateFilename, const char *pszDefaultFilename)
    104110        : AbstractScript(pSetError)
     
    162168
    163169public:
     170    DECLARE_TRANSLATE_METHODS(GeneralTextScript)
     171
    164172    GeneralTextScript(VirtualBoxBase *pSetError, const char *pszDefaultTemplateFilename = NULL, const char *pszDefaultFilename = NULL)
    165173        : BaseTextScript(pSetError, pszDefaultTemplateFilename, pszDefaultFilename), mfDataParsed(false)
  • trunk/src/VBox/Main/include/TokenImpl.h

    r82968 r90828  
    3434public:
    3535
    36     DECLARE_EMPTY_CTOR_DTOR(MachineToken)
     36    DECLARE_COMMON_CLASS_METHODS(MachineToken)
    3737
    3838    HRESULT FinalConstruct();
     
    7373public:
    7474
    75     DECLARE_EMPTY_CTOR_DTOR(MediumLockToken)
     75    DECLARE_COMMON_CLASS_METHODS(MediumLockToken)
    7676
    7777    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/USBControllerImpl.h

    r82968 r90828  
    3939public:
    4040
    41     DECLARE_EMPTY_CTOR_DTOR(USBController)
     41    DECLARE_COMMON_CLASS_METHODS(USBController)
    4242
    4343    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/USBDeviceFilterImpl.h

    r82968 r90828  
    6868    };
    6969
    70     DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilter)
     70    DECLARE_COMMON_CLASS_METHODS(USBDeviceFilter)
    7171
    7272    HRESULT FinalConstruct();
     
    161161    };
    162162
    163     DECLARE_EMPTY_CTOR_DTOR (HostUSBDeviceFilter)
     163    DECLARE_COMMON_CLASS_METHODS (HostUSBDeviceFilter)
    164164
    165165    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/USBDeviceFiltersImpl.h

    r82968 r90828  
    3737public:
    3838
    39     DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilters)
     39    DECLARE_COMMON_CLASS_METHODS(USBDeviceFilters)
    4040
    4141    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/USBDeviceImpl.h

    r82968 r90828  
    3333public:
    3434
    35     DECLARE_EMPTY_CTOR_DTOR(OUSBDevice)
     35    DECLARE_COMMON_CLASS_METHODS(OUSBDevice)
    3636
    3737    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/USBProxyBackend.h

    r87376 r90828  
    4444public:
    4545
    46     DECLARE_EMPTY_CTOR_DTOR(USBProxyBackend)
     46    DECLARE_COMMON_CLASS_METHODS(USBProxyBackend)
    4747
    4848    HRESULT FinalConstruct();
     
    148148{
    149149public:
    150     DECLARE_EMPTY_CTOR_DTOR(USBProxyBackendDarwin)
     150    DECLARE_COMMON_CLASS_METHODS(USBProxyBackendDarwin)
    151151
    152152    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId,
     
    190190{
    191191public:
    192     DECLARE_EMPTY_CTOR_DTOR(USBProxyBackendLinux)
     192    DECLARE_COMMON_CLASS_METHODS(USBProxyBackendLinux)
    193193
    194194    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId,
     
    243243{
    244244public:
    245     DECLARE_EMPTY_CTOR_DTOR(USBProxyBackendOs2)
     245    DECLARE_COMMON_CLASS_METHODS(USBProxyBackendOs2)
    246246
    247247    virtual int captureDevice(HostUSBDevice *aDevice);
     
    282282{
    283283public:
    284     DECLARE_EMPTY_CTOR_DTOR(USBProxyBackendSolaris)
     284    DECLARE_COMMON_CLASS_METHODS(USBProxyBackendSolaris)
    285285
    286286    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId,
     
    318318{
    319319public:
    320     DECLARE_EMPTY_CTOR_DTOR(USBProxyBackendWindows)
     320    DECLARE_COMMON_CLASS_METHODS(USBProxyBackendWindows)
    321321
    322322    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId,
     
    350350{
    351351public:
    352     DECLARE_EMPTY_CTOR_DTOR(USBProxyBackendFreeBSD)
     352    DECLARE_COMMON_CLASS_METHODS(USBProxyBackendFreeBSD)
    353353
    354354    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId,
     
    402402{
    403403public:
    404     DECLARE_EMPTY_CTOR_DTOR(USBProxyBackendUsbIp)
     404    DECLARE_COMMON_CLASS_METHODS(USBProxyBackendUsbIp)
    405405
    406406    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId,
  • trunk/src/VBox/Main/include/USBProxyService.h

    r82968 r90828  
    4444class USBProxyService
    4545    : public VirtualBoxTranslatable
     46    , public Lockable
    4647{
    4748public:
     49    DECLARE_TRANSLATE_METHODS(USBProxyService)
     50
    4851    USBProxyService(Host *aHost);
    4952    virtual HRESULT init(void);
  • trunk/src/VBox/Main/include/UnattendedImpl.h

    r86274 r90828  
    4141{
    4242public:
    43     DECLARE_EMPTY_CTOR_DTOR(Unattended)
     43    DECLARE_COMMON_CLASS_METHODS(Unattended)
    4444
    4545    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/UnattendedInstaller.h

    r86659 r90828  
    3636 * execute an unattended installation
    3737 */
    38 class UnattendedInstaller : public RTCNonCopyable
     38class UnattendedInstaller : public RTCNonCopyable, public VirtualBoxTranslatable
    3939{
    4040/*data*/
     
    7070
    7171public:
     72    DECLARE_TRANSLATE_METHODS(UnattendedInstaller)
     73
    7274    /**
    7375     * Regular constructor.
     
    369371{
    370372public:
     373    DECLARE_TRANSLATE_METHODS(UnattendedWindowsSifInstaller)
     374
    371375    UnattendedWindowsSifInstaller(Unattended *pParent)
    372376        : UnattendedInstaller(pParent,
     
    387391{
    388392public:
     393    DECLARE_TRANSLATE_METHODS(UnattendedWindowsXmlInstaller)
     394
    389395    UnattendedWindowsXmlInstaller(Unattended *pParent)
    390396        : UnattendedInstaller(pParent,
     
    410416
    411417public:
     418    DECLARE_TRANSLATE_METHODS(UnattendedLinuxInstaller)
     419
    412420    UnattendedLinuxInstaller(Unattended *pParent,
    413421                             const char *pszMainScriptTemplateName, const char *pszPostScriptTemplateName,
     
    439447{
    440448public:
     449    DECLARE_TRANSLATE_METHODS(UnattendedDebianInstaller)
     450
    441451    UnattendedDebianInstaller(Unattended *pParent,
    442452                              const char *pszMainScriptTemplateName = "debian_preseed.cfg",
     
    482492{
    483493public:
     494    DECLARE_TRANSLATE_METHODS(UnattendedUbuntuInstaller)
     495
    484496    UnattendedUbuntuInstaller(Unattended *pParent)
    485497        : UnattendedDebianInstaller(pParent, "ubuntu_preseed.cfg")
     
    497509{
    498510public:
     511    DECLARE_TRANSLATE_METHODS(UnattendedRhel6Installer)
     512
    499513    UnattendedRhel6Installer(Unattended *pParent,
    500514                             const char *pszMainScriptTemplateName = "redhat67_ks.cfg",
     
    525539{
    526540public:
     541    DECLARE_TRANSLATE_METHODS(UnattendedRhel7Installer)
     542
    527543    UnattendedRhel7Installer(Unattended *pParent)
    528544        : UnattendedRhel6Installer(pParent)
     
    546562{
    547563public:
     564    DECLARE_TRANSLATE_METHODS(UnattendedRhel8Installer)
     565
    548566    UnattendedRhel8Installer(Unattended *pParent)
    549567        : UnattendedRhel7Installer(pParent)
     
    566584{
    567585public:
     586    DECLARE_TRANSLATE_METHODS(UnattendedRhel5Installer)
     587
    568588    UnattendedRhel5Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel5_ks.cfg") {}
    569589    ~UnattendedRhel5Installer() {}
     
    577597{
    578598public:
     599    DECLARE_TRANSLATE_METHODS(UnattendedRhel4Installer)
     600
    579601    UnattendedRhel4Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel4_ks.cfg") {}
    580602    ~UnattendedRhel4Installer() {}
     
    588610{
    589611public:
     612    DECLARE_TRANSLATE_METHODS(UnattendedRhel3Installer)
     613
    590614    UnattendedRhel3Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel3_ks.cfg") {}
    591615    ~UnattendedRhel3Installer() {}
     
    599623{
    600624public:
     625    DECLARE_TRANSLATE_METHODS(UnattendedFedoraInstaller)
     626
    601627    UnattendedFedoraInstaller(Unattended *pParent)
    602628        : UnattendedRhel6Installer(pParent, "fedora_ks.cfg")
     
    613639{
    614640public:
     641    DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux6Installer)
     642
    615643    UnattendedOracleLinux6Installer(Unattended *pParent,
    616644                                    const char *pszMainScriptTemplateName = "ol_ks.cfg",
     
    630658{
    631659public:
     660    DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux7Installer)
     661
    632662    UnattendedOracleLinux7Installer(Unattended *pParent)
    633663        : UnattendedOracleLinux6Installer(pParent)
     
    651681{
    652682public:
     683    DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux8Installer)
     684
    653685    UnattendedOracleLinux8Installer(Unattended *pParent)
    654686        : UnattendedOracleLinux7Installer(pParent)
     
    673705{
    674706public:
     707    DECLARE_TRANSLATE_METHODS(UnattendedSuseInstaller)
     708
    675709    UnattendedSuseInstaller(BaseTextScript *pAlg, Unattended *pParent)
    676710        : UnattendedLinuxInstaller(pAlg, pParent, "suse_autoinstall.xml")
  • trunk/src/VBox/Main/include/UnattendedScript.h

    r86659 r90828  
    4343
    4444public:
     45    DECLARE_TRANSLATE_METHODS(UnattendedScriptTemplate)
     46
    4547    UnattendedScriptTemplate(Unattended *pUnattended, const char *pszDefaultTemplateFilename, const char *pszDefaultFilename);
    4648    virtual ~UnattendedScriptTemplate()             {}
     
    105107{
    106108public:
     109    DECLARE_TRANSLATE_METHODS(UnattendedSUSEXMLScript)
     110
    107111    UnattendedSUSEXMLScript(VirtualBoxBase *pSetError, const char *pszDefaultFilename = "autoinst.xml")
    108112        : UnattendedXMLScript(pSetError, pszDefaultFilename) {}
  • trunk/src/VBox/Main/include/VFSExplorerImpl.h

    r82968 r90828  
    2929public:
    3030
    31     DECLARE_EMPTY_CTOR_DTOR(VFSExplorer)
     31    DECLARE_COMMON_CLASS_METHODS(VFSExplorer)
    3232
    3333    // public initializer/uninitializer for internal purposes only
     
    3939
    4040    /* public methods only for internal purposes */
    41     static HRESULT setErrorStatic(HRESULT aResultCode,
    42                                   const Utf8Str &aText)
     41    static HRESULT setErrorStatic(HRESULT aResultCode, const char *aText, ...)
    4342    {
    44         return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
     43        va_list va;
     44        va_start(va, aText);
     45        HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true);
     46        va_end(va);
     47        return hrc;
    4548    }
    4649
  • trunk/src/VBox/Main/include/VRDEServerImpl.h

    r82968 r90828  
    3636public:
    3737
    38     DECLARE_EMPTY_CTOR_DTOR(VRDEServer)
     38    DECLARE_COMMON_CLASS_METHODS(VRDEServer)
    3939
    4040    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r82968 r90828  
    3535
    3636#include "VBox/com/VirtualBox.h"
     37
     38#include "VirtualBoxTranslator.h"
    3739
    3840// avoid including VBox/settings.h and VBox/xml.h; only declare the classes
     
    570572 */
    571573class ATL_NO_VTABLE VirtualBoxTranslatable
    572     : public Lockable
    573574{
    574575public:
    575 
    576576    /**
    577      * Placeholder method with which translations can one day be implemented
    578      * in Main. This gets called by the tr() function.
    579      * @param context
    580      * @param pcszSourceText
    581      * @param comment
    582      * @return
     577     * Returns translated text.
     578     *
     579     * @param aContext      Translation context e.g. class name
     580     * @param aSourceText   String to translate.
     581     * @param aComment      Comment to the string to resolve possible ambiguities
     582     *                      (NULL means no comment). Used by translation tool only.
     583     * @param aNum          Number used to define plural form of the translation.
     584     *
     585     * @return Translated text.
    583586     */
    584     static const char *translate(const char *context,
    585                                  const char *pcszSourceText,
    586                                  const char *comment = 0)
    587     {
    588         NOREF(context);
    589         NOREF(comment);
    590         return pcszSourceText;
     587    static const char *translate(const char *aComponent,
     588                                 const char *aSourceText,
     589                                 const char *aComment = NULL,
     590                                 const int   aNum = -1)
     591    {
     592#ifdef VBOX_WITH_MAIN_NLS
     593        return VirtualBoxTranslator::translate(aComponent, aSourceText, aComment, aNum);
     594#else
     595        RT_NOREF(aComponent, aComment, aNum);
     596        return aSourceText;
     597#endif
    591598    }
    592599
    593600    /**
    594      * Translates the given text string by calling translate() and passing
    595      * the name of the C class as the first argument ("context of
    596      * translation"). See VirtualBoxBase::translate() for more info.
    597      *
    598      * @param pcszSourceText String to translate.
    599      * @param aComment      Comment to the string to resolve possible
    600      *                      ambiguities (NULL means no comment).
    601      *
    602      * @return Translated version of the source string in UTF-8 encoding, or
    603      *      the source string itself if the translation is not found in the
    604      *      specified context.
     601     * Returns source text stored in the cache if exists.
     602     * Otherwise, the @a aTranslation itself returned.
    605603     */
    606     inline static const char *tr(const char *pcszSourceText,
    607                                  const char *aComment = NULL)
    608     {
    609         return VirtualBoxTranslatable::translate(NULL, // getComponentName(), eventually
    610                                                  pcszSourceText,
    611                                                  aComment);
     604    static const char *trSource(const char *aTranslation)
     605    {
     606#ifdef VBOX_WITH_MAIN_NLS
     607        return VirtualBoxTranslator::trSource(aTranslation);
     608#else
     609        return aTranslation;
     610#endif
    612611    }
    613612};
     
    618617//
    619618////////////////////////////////////////////////////////////////////////////////
     619
     620#ifdef VBOX_WITH_MAIN_NLS
     621# define DECLARE_TRANSLATE_METHODS(cls) \
     622    static inline const char *tr(const char *aSourceText, \
     623                                 const char *aComment = NULL, \
     624                                 const int   aNum = -1) \
     625    { \
     626        return VirtualBoxTranslatable::translate(#cls, aSourceText, aComment, aNum); \
     627    }
     628#else
     629# define DECLARE_TRANSLATE_METHODS(cls) \
     630    static inline const char *tr(const char *aSourceText, \
     631                                 const char *aComment = NULL, \
     632                                 const int   aNum = -1) \
     633    { \
     634        RT_NOREF(aComment, aNum); \
     635        return aSourceText; \
     636    }
     637#endif
     638
     639#define DECLARE_COMMON_CLASS_METHODS(cls) \
     640    DECLARE_EMPTY_CTOR_DTOR(cls) \
     641    DECLARE_TRANSLATE_METHODS(cls)
    620642
    621643#define VIRTUALBOXBASE_ADD_VIRTUAL_COMPONENT_METHODS(cls, iface) \
     
    696718 */
    697719class ATL_NO_VTABLE VirtualBoxBase
    698     : public VirtualBoxTranslatable,
    699       public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>
     720    : public VirtualBoxTranslatable
     721    , public Lockable
     722    , public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>
    700723#if !defined (VBOX_WITH_XPCOM)
    701724    , public ISupportErrorInfo
     
    711734
    712735public:
    713     VirtualBoxBase();
    714     virtual ~VirtualBoxBase();
     736    DECLARE_COMMON_CLASS_METHODS(VirtualBoxBase)
    715737
    716738    /**
     
    767789    static HRESULT handleUnexpectedExceptions(VirtualBoxBase *const aThis, RT_SRC_POS_DECL);
    768790
    769     static HRESULT setErrorInternal(HRESULT aResultCode,
    770                                     const GUID &aIID,
    771                                     const char *aComponent,
    772                                     Utf8Str aText,
    773                                     bool aWarning,
    774                                     bool aLogIt,
    775                                     LONG aResultDetail = 0);
     791    static HRESULT setErrorInternalF(HRESULT aResultCode,
     792                                     const GUID &aIID,
     793                                     const char *aComponent,
     794                                     bool aWarning,
     795                                     bool aLogIt,
     796                                     LONG aResultDetail,
     797                                     const char *aText, ...);
     798    static HRESULT setErrorInternalV(HRESULT aResultCode,
     799                                     const GUID &aIID,
     800                                     const char *aComponent,
     801                                     const char *aText,
     802                                     va_list aArgs,
     803                                     bool aWarning,
     804                                     bool aLogIt,
     805                                     LONG aResultDetail = 0);
    776806    static void clearError(void);
    777807
  • trunk/src/VBox/Main/include/VirtualBoxClientImpl.h

    r82968 r90828  
    2424#include "VirtualBoxClientWrap.h"
    2525#include "EventImpl.h"
     26#include "VirtualBoxTranslator.h"
    2627
    2728#ifdef RT_OS_WINDOWS
     
    101102        RTTHREAD m_ThreadWatcher;
    102103        RTSEMEVENT m_SemEvWatcher;
     104#ifdef VBOX_WITH_MAIN_NLS
     105        VirtualBoxTranslator *m_pVBoxTranslator;
     106#endif
    103107    };
    104108
     
    110114     * m_pEventSource and is decremented by the Data destructor (above). */
    111115    static LONG s_cUnnecessaryAtlModuleLocks;
     116
     117#ifdef VBOX_WITH_MAIN_NLS
     118    HRESULT i_reloadApiLanguage();
     119    HRESULT i_registerEventListener();
     120#endif
    112121};
    113122
  • trunk/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h

    r82968 r90828  
    3131#ifndef VBOX_WITH_XPCOM /* IErrorInfo doesn't inherit from IDispatch, ugly 3am hack: */
    3232    , public IDispatch
     33    , public VirtualBoxTranslatable
    3334#endif
    3435{
     
    4546        COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler)
    4647    END_COM_MAP()
     48
     49    DECLARE_TRANSLATE_METHODS(VirtualBoxErrorInfo)
    4750
    4851    HRESULT FinalConstruct()
     
    139142    STDMETHOD(COMGETTER(Next))(IVirtualBoxErrorInfo **aNext);
    140143
     144    const char* getComponentName() const { return "VirtualBoxErrorInfo"; }
     145
    141146private:
    142     // FIXME: declare these here until VBoxSupportsTranslation base
    143     //        is available in this class.
    144     static const char *tr(const char *a) { return a; }
    145147    static HRESULT setError(HRESULT rc,
    146148                            const char * /* a */,
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r90440 r90828  
    112112
    113113    // to postpone generation of the default ctor/dtor
    114     DECLARE_EMPTY_CTOR_DTOR(VirtualBox)
     114    DECLARE_COMMON_CLASS_METHODS(VirtualBox)
    115115
    116116    HRESULT FinalConstruct();
     
    201201
    202202    void i_onProgressCreated(const Guid &aId, BOOL aCreated);
     203
     204    void i_onLanguageChanged(const Utf8Str &aLanguageId);
    203205
    204206#ifdef VBOX_WITH_CLOUD_NET
     
    395397                             ComPtr<IProgress> &aProgressObject);
    396398
    397     static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const Utf8Str &aText)
     399    static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const char *aText, ...)
    398400    {
    399         return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true, vrc);
     401        va_list va;
     402        va_start (va, aText);
     403        HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true, vrc);
     404        va_end(va);
     405        return hrc;
    400406    }
    401407
  • trunk/src/VBox/Main/include/VirtualBoxSDSImpl.h

    r82968 r90828  
    8383    END_COM_MAP()
    8484
    85     DECLARE_EMPTY_CTOR_DTOR(VirtualBoxSDS)
     85    DECLARE_COMMON_CLASS_METHODS(VirtualBoxSDS)
    8686
    8787    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/src-all/QMTranslatorImpl.cpp

    r85212 r90828  
    2323#include <iprt/file.h>
    2424#include <iprt/asm.h>
     25#include <iprt/string.h>
     26#include <iprt/strcache.h>
    2527#include <VBox/com/string.h>
    2628#include <VBox/log.h>
     
    4749class QMBytesStream
    4850{
    49     size_t m_cbSize;
     51    size_t         m_cbSize;
    5052    const uint8_t * const m_dataStart;
    5153    const uint8_t *m_iter;
    5254    const uint8_t *m_end;
    53 
    54     /* Function stub for transform method */
    55     static uint16_t func_BE2H_U16(uint16_t value)
    56     {
    57         return RT_BE2H_U16(value);
    58     }
    5955
    6056public:
     
    9490        uint32_t size = read32();
    9591        checkSize(size);
    96         if (size & 1) throw QMException("Incorrect string size");
    97         std::vector<uint16_t> wstr;
    98         wstr.reserve(size / 2);
    99 
    100         /* We cannot convert to host endianess without copying the data
    101          * since the file might be mapped to the memory and any memory
    102          * change will lead to the change of the file. */
    103         std::transform(reinterpret_cast<const uint16_t *>(m_iter),
    104                        reinterpret_cast<const uint16_t *>(m_iter + size),
    105                        std::back_inserter(wstr),
    106                        func_BE2H_U16);
     92        if (size & 1)
     93            throw QMException("Incorrect string size");
     94
     95        /* UTF-16 can encode up to codepoint U+10ffff, which UTF-8 needs 4 bytes
     96           to encode, so reserve twice the size plus a terminator for the result. */
     97        com::Utf8Str result;
     98        result.reserve(size * 2 + 1);
     99        char *pszStr = result.mutableRaw();
     100        int rc = RTUtf16BigToUtf8Ex((PCRTUTF16)m_iter, size >> 1, &pszStr, result.capacity(), NULL);
     101        if (RT_SUCCESS(rc))
     102            result.jolt();
     103        else
     104            throw QMException("Translation from UTF-16 to UTF-8 failed");
     105
    107106        m_iter += size;
    108         return com::Utf8Str((CBSTR) &wstr.front(), wstr.size());
    109     }
    110 
    111     /** Reads string in one-byte encoding.
    112      * The string is assumed to be in ISO-8859-1 encoding */
     107        return result;
     108    }
     109
     110    /**
     111     *  Reads a string, forcing UTF-8 encoding.
     112     */
    113113    inline com::Utf8Str readString()
    114114    {
    115115        uint32_t size = read32();
    116116        checkSize(size);
     117
    117118        com::Utf8Str result(reinterpret_cast<const char *>(m_iter), size);
     119        if (size > 0)
     120        {
     121            RTStrPurgeEncoding(result.mutableRaw());
     122            result.jolt();
     123        }
     124
    118125        m_iter += size;
    119126        return result;
     127    }
     128
     129    /**
     130     *  Reads memory block
     131     *  Returns number of bytes read
     132     */
     133    inline uint32_t read(char *bBuf, uint32_t cbSize)
     134    {
     135        if (!bBuf || !cbSize)
     136            return 0;
     137        cbSize = RT_MIN(cbSize, (uint32_t)(m_end - m_iter));
     138        memcpy(bBuf, m_iter, cbSize);
     139        m_iter += cbSize;
     140        return cbSize;
    120141    }
    121142
     
    148169    {
    149170        size_t cbLeft = (size_t)(m_end - m_iter);
    150         if (cbLeft <= offSkip)
     171        if (cbLeft >= offSkip)
    151172            m_iter += offSkip;
    152173        else
     
    166187class QMTranslator_Impl
    167188{
    168     struct QMMessage
     189    /** Used while parsing */
     190    struct QMMessageParse
    169191    {
    170192        /* Everything is in UTF-8 */
     193        std::vector<com::Utf8Str> astrTranslations;
    171194        com::Utf8Str strContext;
    172         com::Utf8Str strTranslation;
    173195        com::Utf8Str strComment;
    174196        com::Utf8Str strSource;
    175         uint32_t     hash;
    176         QMMessage() : hash(0) {}
     197
     198        QMMessageParse() {}
     199    };
     200
     201    struct QMMessage
     202    {
     203        const char *pszContext;
     204        const char *pszSource;
     205        const char *pszComment;
     206        std::vector<const char *> vecTranslations;
     207        uint32_t    hash;
     208
     209        QMMessage() : pszContext(NULL), pszSource(NULL), pszComment(NULL), hash(0)
     210        {}
     211
     212        QMMessage(RTSTRCACHE hStrCache, const QMMessageParse &rSrc)
     213            : pszContext(addStr(hStrCache, rSrc.strContext))
     214            , pszSource(addStr(hStrCache, rSrc.strSource))
     215            , pszComment(addStr(hStrCache, rSrc.strComment))
     216            , hash(RTStrHash1(pszSource))
     217        {
     218            for (size_t i = 0; i < rSrc.astrTranslations.size(); i++)
     219                vecTranslations.push_back(addStr(hStrCache, rSrc.astrTranslations[i]));
     220        }
     221
     222        /** Helper. */
     223        static const char *addStr(RTSTRCACHE hStrCache, const com::Utf8Str &rSrc)
     224        {
     225            if (rSrc.isNotEmpty())
     226            {
     227                const char *psz = RTStrCacheEnterN(hStrCache, rSrc.c_str(), rSrc.length());
     228                if (RT_LIKELY(psz))
     229                    return psz;
     230                throw std::bad_alloc();
     231            }
     232            return NULL;
     233        }
     234
    177235    };
    178236
     
    182240        uint32_t offset;
    183241
    184         HashOffset(uint32_t _hash = 0, uint32_t _offs = 0) : hash(_hash), offset(_offs) {}
     242        HashOffset(uint32_t a_hash = 0, uint32_t a_offs = 0) : hash(a_hash), offset(a_offs) {}
    185243
    186244        bool operator<(const HashOffset &obj) const
     
    194252    typedef QMHashSet::const_iterator QMHashSetConstIter;
    195253    typedef std::vector<QMMessage> QMMessageArray;
    196 
    197     QMHashSet m_hashSet;
     254    typedef std::vector<uint8_t> QMByteArray;
     255
     256    QMHashSet      m_hashSet;
    198257    QMMessageArray m_messageArray;
     258    QMByteArray    m_pluralRules;
    199259
    200260public:
    201261
    202262    QMTranslator_Impl() {}
     263
     264    enum PluralOpCodes
     265    {
     266        Pl_Eq          = 0x01,
     267        Pl_Lt          = 0x02,
     268        Pl_Leq         = 0x03,
     269        Pl_Between     = 0x04,
     270
     271        Pl_OpMask      = 0x07,
     272
     273        Pl_Not         = 0x08,
     274        Pl_Mod10       = 0x10,
     275        Pl_Mod100      = 0x20,
     276        Pl_Lead1000    = 0x40,
     277
     278        Pl_And         = 0xFD,
     279        Pl_Or          = 0xFE,
     280        Pl_NewRule     = 0xFF,
     281
     282        Pl_LMask       = 0x80,
     283    };
     284
     285    /*
     286     * Rules format:
     287     * <O><2>[<3>][<&&><O><2>[<3>]]...[<||><O><2>[<3>][<&&><O><2>[<3>]]...]...[<New><O>...]...
     288     * where:
     289     *    <O> - OpCode
     290     *    <2> - Second operand
     291     *    <3> - Third operand
     292     *    <&&> - 'And' operation
     293     *    <||> - 'Or' operation
     294     *    <New> - Start of rule for next plural form
     295     * Rules are ordered by plural forms, i.e:
     296     *   <rule for first form (i.e. single)><New><rule for next form>...
     297     */
     298    bool checkPlural(const QMByteArray &aRules) const
     299    {
     300        if (aRules.empty())
     301            return true;
     302
     303        uint32_t iPos = 0;
     304        do {
     305            uint8_t bOpCode = aRules[iPos];
     306
     307            /* Invalid place of And/Or/NewRule */
     308            if (bOpCode & Pl_LMask)
     309                return false;
     310
     311            /* 2nd operand */
     312            iPos++;
     313
     314            /* 2nd operand missing */
     315            if (iPos == aRules.size())
     316                return false;
     317
     318            /* Invalid OpCode */
     319            if ((bOpCode & Pl_OpMask) == 0)
     320                return false;
     321
     322            if ((bOpCode & Pl_OpMask) == Pl_Between)
     323            {
     324                /* 3rd operand */
     325                iPos++;
     326
     327                /* 3rd operand missing */
     328                if (iPos == aRules.size())
     329                    return false;
     330            }
     331
     332            /* And/Or/NewRule */
     333            iPos++;
     334
     335            /* All rules checked */
     336            if (iPos == aRules.size())
     337                return true;
     338
     339        } while (   (   (aRules[iPos] == Pl_And)
     340                     || (aRules[iPos] == Pl_Or)
     341                     || (aRules[iPos] == Pl_NewRule))
     342                 && ++iPos != aRules.size());
     343
     344        return false;
     345    }
     346
     347    int plural(int aNum) const
     348    {
     349        if (aNum < 1 || m_pluralRules.empty())
     350            return 0;
     351
     352        int  iPluralNumber = 0;
     353        uint32_t iPos = 0;
     354
     355        /* Rules loop */
     356        for (;;)
     357        {
     358            bool fOr = false;
     359            /* 'Or' loop */
     360            for (;;)
     361            {
     362                bool fAnd = true;
     363                /* 'And' loop */
     364                for (;;)
     365                {
     366                    int iOpCode = m_pluralRules[iPos++];
     367                    int iOpLeft = aNum;
     368                    if (iOpCode & Pl_Mod10)
     369                        iOpLeft %= 10;
     370                    else if (iOpCode & Pl_Mod100)
     371                        iOpLeft %= 100;
     372                    else if (iOpLeft & Pl_Lead1000)
     373                    {
     374                        while (iOpLeft >= 1000)
     375                            iOpLeft /= 1000;
     376                    }
     377                    int iOpRight = m_pluralRules[iPos++];
     378                    int iOp = iOpCode & Pl_OpMask;
     379                    int iOpRight1 = 0;
     380                    if (iOp == Pl_Between)
     381                        iOpRight1 = m_pluralRules[iPos++];
     382
     383                    bool fResult =    (iOp == Pl_Eq      && iOpLeft == iOpRight)
     384                            || (iOp == Pl_Lt      && iOpLeft <  iOpRight)
     385                            || (iOp == Pl_Leq     && iOpLeft <= iOpRight)
     386                            || (iOp == Pl_Between && iOpLeft >= iOpRight && iOpLeft <= iOpRight1);
     387                    if (iOpCode & Pl_Not)
     388                        fResult = !fResult;
     389
     390                    fAnd = fAnd && fResult;
     391                    if (iPos == m_pluralRules.size() || m_pluralRules[iPos] != Pl_And)
     392                        break;
     393                    iPos++;
     394                }
     395                fOr = fOr || fAnd;
     396                if (iPos == m_pluralRules.size() || m_pluralRules[iPos] != Pl_Or)
     397                    break;
     398                iPos++;
     399            }
     400            if (fOr)
     401                return iPluralNumber;
     402
     403            /* Qt returns last plural number if none of rules are match. */
     404            iPluralNumber++;
     405
     406            if (iPos >= m_pluralRules.size())
     407                return iPluralNumber;
     408
     409            iPos++; // Skip Pl_NewRule
     410        }
     411    }
    203412
    204413    const char *translate(const char *pszContext,
    205414                          const char *pszSource,
    206                           const char *pszDisamb) const
     415                          const char *pszDisamb,
     416                          const int   aNum) const
    207417    {
    208418        QMHashSetConstIter iter;
    209419        QMHashSetConstIter lowerIter, upperIter;
    210420
    211         do {
    212             uint32_t hash = calculateHash(pszSource, pszDisamb);
    213             lowerIter = m_hashSet.lower_bound(HashOffset(hash, 0));
    214             upperIter = m_hashSet.upper_bound(HashOffset(hash, UINT32_MAX));
    215 
     421        /* As turned out, comments (pszDisamb) are not kept always in result qm file
     422         * Therefore, exclude them from the hash */
     423        uint32_t hash = RTStrHash1(pszSource);
     424        lowerIter = m_hashSet.lower_bound(HashOffset(hash, 0));
     425        upperIter = m_hashSet.upper_bound(HashOffset(hash, UINT32_MAX));
     426
     427        /*
     428         * Check different combinations with and without context and
     429         * disambiguation. This can help us to find the translation even
     430         * if context or disambiguation are not know or properly defined.
     431         */
     432        const char *apszCtx[]    = {pszContext, pszContext, NULL,      NULL};
     433        const char *apszDisabm[] = {pszDisamb,  NULL,       pszDisamb, NULL};
     434        AssertCompile(RT_ELEMENTS(apszCtx) == RT_ELEMENTS(apszDisabm));
     435
     436        for (size_t i = 0; i < RT_ELEMENTS(apszCtx); ++i)
     437        {
    216438            for (iter = lowerIter; iter != upperIter; ++iter)
    217439            {
    218440                const QMMessage &message = m_messageArray[iter->offset];
    219                 if ((!pszContext || !*pszContext || message.strContext == pszContext) &&
    220                     message.strSource == pszSource &&
    221                     ((pszDisamb && !*pszDisamb) || message.strComment == pszDisamb))
    222                     break;
     441                if (   RTStrCmp(message.pszSource, pszSource) == 0
     442                    && (!apszCtx[i]     || !*apszCtx[i]     || RTStrCmp(message.pszContext, apszCtx[i]) == 0)
     443                    && (!apszDisabm[i]  || !*apszDisabm[i]  || RTStrCmp(message.pszComment, apszDisabm[i]) == 0 ))
     444                {
     445                    const std::vector<const char *> &vecTranslations = m_messageArray[iter->offset].vecTranslations;
     446                    size_t idxPlural = plural(aNum);
     447                    return vecTranslations[RT_MIN(idxPlural, vecTranslations.size() - 1)];
     448                }
    223449            }
    224 
    225             /* Try without disambiguating comment if it isn't empty */
    226             if (pszDisamb)
    227             {
    228                 if (!*pszDisamb) pszDisamb = 0;
    229                 else pszDisamb = "";
    230             }
    231 
    232         } while (iter == upperIter && pszDisamb);
    233 
    234         return (iter != upperIter ? m_messageArray[iter->offset].strTranslation.c_str() : "");
    235     }
    236 
    237     void load(QMBytesStream &stream)
     450        }
     451
     452        return pszSource;
     453    }
     454
     455    void load(QMBytesStream &stream, RTSTRCACHE hStrCache)
    238456    {
    239457        /* Load into local variables. If we failed during the load,
     
    241459        QMHashSet hashSet;
    242460        QMMessageArray messageArray;
     461        QMByteArray pluralRules;
    243462
    244463        stream.checkMagic();
     
    255474            {
    256475                case Messages:
    257                     parseMessages(stream, &hashSet, &messageArray, sLen);
     476                    parseMessages(stream, hStrCache, &hashSet, &messageArray, sLen);
    258477                    break;
    259478                case Hashes:
    260479                    /* Only get size information to speed-up vector filling
    261480                     * if Hashes section goes in the file before Message section */
    262                     m_messageArray.reserve(sLen >> 3);
    263                     RT_FALL_THRU();
    264                 case Context:
     481                    if (messageArray.empty())
     482                        messageArray.reserve(sLen >> 3);
     483                    stream.seek(sLen);
     484                    break;
     485                case NumerusRules:
     486                {
     487                    pluralRules.resize(sLen);
     488                    uint32_t cbSize = stream.read((char *)&pluralRules[0], sLen);
     489                    if (cbSize < sLen)
     490                        throw QMException("Incorrect section size");
     491                    if (!checkPlural(pluralRules))
     492                        pluralRules.erase(pluralRules.begin(), pluralRules.end());
     493                    break;
     494                }
     495                case Contexts:
     496                case Dependencies:
     497                case Language:
    265498                    stream.seek(sLen);
    266499                    break;
     
    269502            }
    270503        }
     504
    271505        /* Store the data into member variables.
    272506         * The following functions never generate exceptions */
    273507        m_hashSet.swap(hashSet);
    274508        m_messageArray.swap(messageArray);
     509        m_pluralRules.swap(pluralRules);
    275510    }
    276511
     
    280515    enum SectionType
    281516    {
    282         Hashes   = 0x42,
    283         Messages = 0x69,
    284         Contexts = 0x2f
     517        Contexts     = 0x2f,
     518        Hashes       = 0x42,
     519        Messages     = 0x69,
     520        NumerusRules = 0x88,
     521        Dependencies = 0x96,
     522        Language     = 0xa7
    285523    };
    286524
     
    291529        Translation  = 3,
    292530        Context16    = 4,
    293         Hash         = 5,
     531        Obsolete1    = 5,  /**< was Hash */
    294532        SourceText   = 6,
    295533        Context      = 7,
     
    298536
    299537    /* Read messages from the stream. */
    300     static void parseMessages(QMBytesStream &stream, QMHashSet * const hashSet, QMMessageArray * const messageArray, size_t cbSize)
     538    static void parseMessages(QMBytesStream &stream, RTSTRCACHE hStrCache, QMHashSet * const hashSet,
     539                              QMMessageArray * const messageArray, size_t cbSize)
    301540    {
    302541        stream.setEnd(stream.tellPos() + cbSize);
     
    304543        while (!stream.hasFinished())
    305544        {
    306             QMMessage message;
    307             HashOffset hashOffs;
    308 
    309             parseMessageRecord(stream, &message);
    310             if (!message.hash)
    311                 message.hash = calculateHash(message.strSource.c_str(), message.strComment.c_str());
    312 
    313             hashOffs.hash = message.hash;
    314             hashOffs.offset = cMessage++;
    315 
    316             hashSet->insert(hashOffs);
    317             messageArray->push_back(message);
     545            /* Process the record. Skip anything that doesn't have a source
     546               string or any valid translations.  Using C++ strings for temporary
     547               storage here, as we don't want to pollute the cache we bogus strings
     548               in case of duplicate sub-records or invalid records. */
     549            QMMessageParse ParsedMsg;
     550            parseMessageRecord(stream, &ParsedMsg);
     551            if (   ParsedMsg.astrTranslations.size() > 0
     552                && ParsedMsg.strSource.isNotEmpty())
     553            {
     554                /* Copy the strings over into the string cache and a hashed QMMessage,
     555                   before adding it to the result. */
     556                QMMessage HashedMsg(hStrCache, ParsedMsg);
     557                hashSet->insert(HashOffset(HashedMsg.hash, cMessage++));
     558                messageArray->push_back(HashedMsg);
     559
     560            }
     561            /*else: wtf? */
    318562        }
    319563        stream.setEnd();
     
    321565
    322566    /* Parse one message from the stream */
    323     static void parseMessageRecord(QMBytesStream &stream, QMMessage * const message)
     567    static void parseMessageRecord(QMBytesStream &stream, QMMessageParse * const message)
    324568    {
    325569        while (!stream.hasFinished())
     
    336580                    break;
    337581                case Translation:
    338                 {
    339                     com::Utf8Str str = stream.readUtf16String();
    340                     message->strTranslation.swap(str);
    341                     break;
    342                 }
    343                 case Hash:
    344                     message->hash = stream.read32();
     582                    message->astrTranslations.push_back(stream.readUtf16String());
    345583                    break;
    346584
    347585                case SourceText:
    348                 {
    349                     com::Utf8Str str = stream.readString();
    350                     message->strSource.swap(str);
    351                     break;
    352                 }
     586                    message->strSource = stream.readString();
     587                    break;
    353588
    354589                case Context:
    355                 {
    356                     com::Utf8Str str = stream.readString();
    357                     message->strContext.swap(str);
    358                     break;
    359                 }
     590                    message->strContext = stream.readString();
     591                    break;
    360592
    361593                case Comment:
    362                 {
    363                     com::Utf8Str str = stream.readString();
    364                     message->strComment.swap(str);
    365                     break;
    366                 }
     594                    message->strComment = stream.readString();
     595                    break;
    367596
    368597                default:
    369                     /* Ignore unknown block */
    370                     LogRel(("QMTranslator::parseMessageRecord(): Unkown message block %x\n", type));
     598                    /* Ignore unknown/obsolete block */
     599                    LogRel(("QMTranslator::parseMessageRecord(): Unknown/obsolete message block %x\n", type));
    371600                    break;
    372601            }
    373602        }
    374603    }
    375 
    376     /* Defines the so called `hashpjw' function by P.J. Weinberger
    377        [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
    378        1986, 1987 Bell Telephone Laboratories, Inc.]   */
    379     static uint32_t calculateHash(const char *pszStr1, const char *pszStr2 = 0)
    380     {
    381         uint32_t hash = 0, g;
    382 
    383         for (const char *pszStr = pszStr1; pszStr != pszStr2; pszStr = pszStr2)
    384             for (; pszStr && *pszStr; pszStr++)
    385             {
    386                 hash = (hash << 4) + static_cast<uint8_t>(*pszStr);
    387 
    388                 if ((g = hash & 0xf0000000ul) != 0)
    389                 {
    390                     hash ^= g >> 24;
    391                     hash ^= g;
    392                 }
    393             }
    394 
    395         return (hash != 0 ? hash : 1);
    396     }
    397604};
    398605
    399606/* Inteface functions implementation */
    400 QMTranslator::QMTranslator() : _impl(new QMTranslator_Impl) {}
    401 
    402 QMTranslator::~QMTranslator() { delete _impl; }
    403 
    404 const char *QMTranslator::translate(const char *pszContext, const char *pszSource, const char *pszDisamb) const throw()
     607QMTranslator::QMTranslator() : m_impl(new QMTranslator_Impl) {}
     608
     609QMTranslator::~QMTranslator() { delete m_impl; }
     610
     611const char *QMTranslator::translate(const char *pszContext, const char *pszSource,
     612                                    const char *pszDisamb, const int aNum) const throw()
    405613{
    406     return _impl->translate(pszContext, pszSource, pszDisamb);
     614    return m_impl->translate(pszContext, pszSource, pszDisamb, aNum);
    407615}
    408616
    409 /* The function is noexcept for now but it may be changed
    410  * to throw exceptions if required to catch them in another
    411  * place. */
    412 int QMTranslator::load(const char *pszFilename) throw()
     617int QMTranslator::load(const char *pszFilename, RTSTRCACHE hStrCache) RT_NOEXCEPT
    413618{
    414619    /* To free safely the file in case of exception */
     
    437642        {
    438643            QMBytesStream stream(loader.data, loader.cbSize);
    439             _impl->load(stream);
     644            m_impl->load(stream, hStrCache);
    440645        }
    441646        return loader.rc;
  • trunk/src/VBox/Main/src-all/TextScript.cpp

    r82968 r90828  
    5353    }
    5454    else
    55         hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Failed to open '%s' (%Rrc)"), rStrFilename.c_str(), vrc);
     55        hrc = mpSetError->setErrorVrc(vrc, tr("Failed to open '%s' (%Rrc)"), rStrFilename.c_str(), vrc);
    5656    return hrc;
    5757}
     
    9494                }
    9595
    96                 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("'%s' isn't valid UTF-8: %Rrc"), pszFilename, vrc);
     96                hrc = mpSetError->setErrorVrc(vrc, tr("'%s' isn't valid UTF-8: %Rrc"), pszFilename, vrc);
    9797            }
    9898            else
    99                 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Error reading '%s': %Rrc"), pszFilename, vrc);
     99                hrc = mpSetError->setErrorVrc(vrc, tr("Error reading '%s': %Rrc"), pszFilename, vrc);
    100100            mStrScriptFullContent.setNull();
    101101        }
    102102        else
    103             hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Failed to allocate memory (%'RU64 bytes) for '%s'"),
     103            hrc = mpSetError->setErrorVrc(vrc, tr("Failed to allocate memory (%'RU64 bytes) for '%s'"),
    104104                                          cbFile, pszFilename);
    105105    }
    106106    else if (RT_SUCCESS(vrc))
    107         hrc = mpSetError->setErrorVrc(VERR_FILE_TOO_BIG,
    108                                       mpSetError->tr("'%s' is too big (max 16MB): %'RU64"), pszFilename, cbFile);
     107        hrc = mpSetError->setErrorVrc(VERR_FILE_TOO_BIG, tr("'%s' is too big (max 16MB): %'RU64"), pszFilename, cbFile);
    109108    else
    110         hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("RTVfsFileQuerySize failed (%Rrc)"), vrc);
     109        hrc = mpSetError->setErrorVrc(vrc, tr("RTVfsFileQuerySize failed (%Rrc)"), vrc);
    111110    return hrc;
    112111}
     
    179178            RTFileClose(hFile);
    180179            RTFileDelete(pszFilename);
    181             hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Error writing to '%s' (%Rrc)"), pszFilename, vrc);
     180            hrc = mpSetError->setErrorVrc(vrc, tr("Error writing to '%s' (%Rrc)"), pszFilename, vrc);
    182181        }
    183182        else
    184             hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Error creating/replacing '%s' (%Rrc)"), pszFilename, vrc);
     183            hrc = mpSetError->setErrorVrc(vrc, tr("Error creating/replacing '%s' (%Rrc)"), pszFilename, vrc);
    185184    }
    186185    return hrc;
  • trunk/src/VBox/Main/src-all/VirtualBoxBase.cpp

    r83787 r90828  
    3434#include "AutoCaller.h"
    3535#include "VirtualBoxErrorInfoImpl.h"
     36#include "VirtualBoxTranslator.h"
    3637#include "Global.h"
    3738#include "LoggingNew.h"
     
    226227    catch (const RTCError &err)      // includes all XML exceptions
    227228    {
    228         return setErrorInternal(E_FAIL, aThis->getClassIID(), aThis->getComponentName(),
    229                                 Utf8StrFmt(tr("%s.\n%s[%d] (%s)"),
    230                                            err.what(),
    231                                            pszFile, iLine, pszFunction).c_str(),
    232                                 false /* aWarning */,
    233                                 true /* aLogIt */);
     229        return setErrorInternalF(E_FAIL, aThis->getClassIID(), aThis->getComponentName(),
     230                                 false /* aWarning */,
     231                                 true /* aLogIt */,
     232                                 0 /* aResultDetail */,
     233                                 tr("%s.\n%s[%d] (%s)"),
     234                                 err.what(), pszFile, iLine, pszFunction);
    234235    }
    235236    catch (const std::exception &err)
    236237    {
    237         return setErrorInternal(E_FAIL, aThis->getClassIID(), aThis->getComponentName(),
    238                                 Utf8StrFmt(tr("Unexpected exception: %s [%s]\n%s[%d] (%s)"),
    239                                            err.what(), typeid(err).name(),
    240                                            pszFile, iLine, pszFunction).c_str(),
    241                                 false /* aWarning */,
    242                                 true /* aLogIt */);
     238        return setErrorInternalF(E_FAIL, aThis->getClassIID(), aThis->getComponentName(),
     239                                 false /* aWarning */,
     240                                 true /* aLogIt */,
     241                                 0 /* aResultDetail */,
     242                                 tr("Unexpected exception: %s [%s]\n%s[%d] (%s)"),
     243                                 err.what(), typeid(err).name(), pszFile, iLine, pszFunction);
    243244    }
    244245    catch (...)
    245246    {
    246         return setErrorInternal(E_FAIL, aThis->getClassIID(), aThis->getComponentName(),
    247                                 Utf8StrFmt(tr("Unknown exception\n%s[%d] (%s)"),
    248                                            pszFile, iLine, pszFunction).c_str(),
    249                                 false /* aWarning */,
    250                                 true /* aLogIt */);
     247        return setErrorInternalF(E_FAIL, aThis->getClassIID(), aThis->getComponentName(),
     248                                 false /* aWarning */,
     249                                 true /* aLogIt */,
     250                                 0 /* aResultDetail */,
     251                                 tr("Unknown exception\n%s[%d] (%s)"),
     252                                 pszFile, iLine, pszFunction);
    251253    }
    252254
     
    257259#endif
    258260}
     261
    259262
    260263/**
     
    266269 *  than an error.
    267270 *
     271 *  @param aResultCode
     272 *  @param aIID
     273 *  @param aComponent
     274 *  @param aWarning
     275 *  @param aLogIt
     276 *  @param aResultDetail
     277 *  @param aText
     278 */
     279/* static */
     280HRESULT VirtualBoxBase::setErrorInternalF(HRESULT aResultCode,
     281                                          const GUID &aIID,
     282                                          const char *aComponent,
     283                                          bool aWarning,
     284                                          bool aLogIt,
     285                                          LONG aResultDetail,
     286                                          const char *aText, ...)
     287{
     288    va_list va;
     289    va_start(va, aText);
     290    HRESULT hres = setErrorInternalV(aResultCode, aIID, aComponent, aText, va,
     291                                     aWarning, aLogIt, aResultDetail);
     292    va_end(va);
     293    return hres;
     294}
     295
     296/**
     297 *  Sets error info for the current thread. This is an internal function that
     298 *  gets eventually called by all public variants.  If @a aWarning is
     299 *  @c true, then the highest (31) bit in the @a aResultCode value which
     300 *  indicates the error severity is reset to zero to make sure the receiver will
     301 *  recognize that the created error info object represents a warning rather
     302 *  than an error.
     303 *
    268304 *  @param  aResultCode
    269305 *  @param  aIID
    270306 *  @param  pcszComponent
    271307 *  @param  aText
     308 *  @param  va
    272309 *  @param  aWarning
    273310 *  @param  aLogIt
     
    275312 */
    276313/* static */
    277 HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
    278                                          const GUID &aIID,
    279                                          const char *pcszComponent,
    280                                          Utf8Str aText,
    281                                          bool aWarning,
    282                                          bool aLogIt,
    283                                          LONG aResultDetail /* = 0*/)
     314HRESULT VirtualBoxBase::setErrorInternalV(HRESULT aResultCode,
     315                                          const GUID &aIID,
     316                                          const char *aComponent,
     317                                          const char *aText,
     318                                          va_list aArgs,
     319                                          bool aWarning,
     320                                          bool aLogIt,
     321                                          LONG aResultDetail /* = 0*/)
    284322{
    285323    /* whether multi-error mode is turned on */
    286324    bool preserve = MultiResult::isMultiEnabled();
    287325
     326    com::Utf8Str strText;
    288327    if (aLogIt)
    289         LogRel(("%s [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%s} aText={%s}, preserve=%RTbool aResultDetail=%d\n",
     328    {
     329        strText = trSource(aText);
     330        va_list va2;
     331        va_copy(va2, aArgs);
     332        LogRel(("%s [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%s} aText={%N}, preserve=%RTbool aResultDetail=%d\n",
    290333                aWarning ? "WARNING" : "ERROR",
    291334                aResultCode,
    292335                aResultCode,
    293336                &aIID,
    294                 pcszComponent,
    295                 aText.c_str(),
     337                aComponent,
     338                strText.c_str(),
     339                &va2,
    296340                preserve,
    297341                aResultDetail));
     342        va_end(va2);
     343    }
    298344
    299345    /* these are mandatory, others -- not */
     
    308354    HRESULT rc = S_OK;
    309355
    310     if (aText.isEmpty())
     356    if (aText == NULL || aText[0] == '\0')
    311357    {
    312358        /* Some default info */
    313359        switch (aResultCode)
    314360        {
    315             case E_INVALIDARG:                 aText = "A parameter has an invalid value"; break;
    316             case E_POINTER:                    aText = "A parameter is an invalid pointer"; break;
    317             case E_UNEXPECTED:                 aText = "The result of the operation is unexpected"; break;
    318             case E_ACCESSDENIED:               aText = "The access to an object is not allowed"; break;
    319             case E_OUTOFMEMORY:                aText = "The allocation of new memory failed"; break;
    320             case E_NOTIMPL:                    aText = "The requested operation is not implemented"; break;
    321             case E_NOINTERFACE:                aText = "The requested interface is not implemented"; break;
    322             case E_FAIL:                       aText = "A general error occurred"; break;
    323             case E_ABORT:                      aText = "The operation was canceled"; break;
    324             case VBOX_E_OBJECT_NOT_FOUND:      aText = "Object corresponding to the supplied arguments does not exist"; break;
    325             case VBOX_E_INVALID_VM_STATE:      aText = "Current virtual machine state prevents the operation"; break;
    326             case VBOX_E_VM_ERROR:              aText = "Virtual machine error occurred attempting the operation"; break;
    327             case VBOX_E_FILE_ERROR:            aText = "File not accessible or erroneous file contents"; break;
    328             case VBOX_E_IPRT_ERROR:            aText = "Runtime subsystem error"; break;
    329             case VBOX_E_PDM_ERROR:             aText = "Pluggable Device Manager error"; break;
    330             case VBOX_E_INVALID_OBJECT_STATE:  aText = "Current object state prohibits operation"; break;
    331             case VBOX_E_HOST_ERROR:            aText = "Host operating system related error"; break;
    332             case VBOX_E_NOT_SUPPORTED:         aText = "Requested operation is not supported"; break;
    333             case VBOX_E_XML_ERROR:             aText = "Invalid XML found"; break;
    334             case VBOX_E_INVALID_SESSION_STATE: aText = "Current session state prohibits operation"; break;
    335             case VBOX_E_OBJECT_IN_USE:         aText = "Object being in use prohibits operation"; break;
    336             case VBOX_E_PASSWORD_INCORRECT:    aText = "Incorrect password provided"; break;
    337             default:                           aText = "Unknown error"; break;
    338         }
     361            case E_INVALIDARG:                 strText = "A parameter has an invalid value"; break;
     362            case E_POINTER:                    strText = "A parameter is an invalid pointer"; break;
     363            case E_UNEXPECTED:                 strText = "The result of the operation is unexpected"; break;
     364            case E_ACCESSDENIED:               strText = "The access to an object is not allowed"; break;
     365            case E_OUTOFMEMORY:                strText = "The allocation of new memory failed"; break;
     366            case E_NOTIMPL:                    strText = "The requested operation is not implemented"; break;
     367            case E_NOINTERFACE:                strText = "The requested interface is not implemented"; break;
     368            case E_FAIL:                       strText = "A general error occurred"; break;
     369            case E_ABORT:                      strText = "The operation was canceled"; break;
     370            case VBOX_E_OBJECT_NOT_FOUND:      strText = "Object corresponding to the supplied arguments does not exist"; break;
     371            case VBOX_E_INVALID_VM_STATE:      strText = "Current virtual machine state prevents the operation"; break;
     372            case VBOX_E_VM_ERROR:              strText = "Virtual machine error occurred attempting the operation"; break;
     373            case VBOX_E_FILE_ERROR:            strText = "File not accessible or erroneous file contents"; break;
     374            case VBOX_E_IPRT_ERROR:            strText = "Runtime subsystem error"; break;
     375            case VBOX_E_PDM_ERROR:             strText = "Pluggable Device Manager error"; break;
     376            case VBOX_E_INVALID_OBJECT_STATE:  strText = "Current object state prohibits operation"; break;
     377            case VBOX_E_HOST_ERROR:            strText = "Host operating system related error"; break;
     378            case VBOX_E_NOT_SUPPORTED:         strText = "Requested operation is not supported"; break;
     379            case VBOX_E_XML_ERROR:             strText = "Invalid XML found"; break;
     380            case VBOX_E_INVALID_SESSION_STATE: strText = "Current session state prohibits operation"; break;
     381            case VBOX_E_OBJECT_IN_USE:         strText = "Object being in use prohibits operation"; break;
     382            case VBOX_E_PASSWORD_INCORRECT:    strText = "Incorrect password provided"; break;
     383            default:                           strText = "Unknown error"; break;
     384        }
     385    }
     386    else
     387    {
     388        va_list va2;
     389        va_copy(va2, aArgs);
     390        strText = com::Utf8StrFmt("%N", aText, &va2);
     391        va_end(va2);
    339392    }
    340393
     
    373426
    374427        /* set the current error info and preserve the previous one if any */
    375         rc = info->initEx(aResultCode, aResultDetail, aIID, pcszComponent, aText, curInfo);
     428        rc = info->initEx(aResultCode, aResultDetail, aIID, aComponent, strText, curInfo);
    376429        if (FAILED(rc)) break;
    377430
     
    417470
    418471            /* set the current error info and preserve the previous one if any */
    419             rc = info->initEx(aResultCode, aResultDetail, aIID, pcszComponent, Bstr(aText), curInfo);
     472            rc = info->initEx(aResultCode, aResultDetail, aIID, aComponent, Bstr(strText), curInfo);
    420473            if (FAILED(rc)) break;
    421474
     
    459512HRESULT VirtualBoxBase::setError(HRESULT aResultCode)
    460513{
    461     return setErrorInternal(aResultCode,
    462                             this->getClassIID(),
    463                             this->getComponentName(),
    464                             "",
    465                             false /* aWarning */,
    466                             true /* aLogIt */);
     514    return setErrorInternalF(aResultCode,
     515                             this->getClassIID(),
     516                             this->getComponentName(),
     517                             false /* aWarning */,
     518                             true /* aLogIt */,
     519                             0 /* aResultDetail */,
     520                             NULL);
    467521}
    468522
     
    480534    va_list args;
    481535    va_start(args, pcsz);
    482     HRESULT rc = setErrorInternal(aResultCode,
    483                                   this->getClassIID(),
    484                                   this->getComponentName(),
    485                                   Utf8Str(pcsz, args),
    486                                   false /* aWarning */,
    487                                   true /* aLogIt */);
     536    HRESULT rc = setErrorInternalV(aResultCode,
     537                                   this->getClassIID(),
     538                                   this->getComponentName(),
     539                                   pcsz, args,
     540                                   false /* aWarning */,
     541                                   true /* aLogIt */);
    488542    va_end(args);
    489543    return rc;
     
    628682HRESULT VirtualBoxBase::setErrorVrc(int vrc)
    629683{
    630     return setErrorInternal(Global::vboxStatusCodeToCOM(vrc),
    631                             this->getClassIID(),
    632                             this->getComponentName(),
    633                             Utf8StrFmt("%Rrc", vrc),
    634                             false /* aWarning */,
    635                             true /* aLogIt */,
    636                             vrc /* aResultDetail */);
     684    return setErrorInternalF(Global::vboxStatusCodeToCOM(vrc),
     685                             this->getClassIID(),
     686                             this->getComponentName(),
     687                             false /* aWarning */,
     688                             true /* aLogIt */,
     689                             vrc /* aResultDetail */,
     690                             Utf8StrFmt("%Rrc", vrc).c_str());
    637691}
    638692
     
    651705    va_list va;
    652706    va_start(va, pcszMsgFmt);
    653     HRESULT hrc = setErrorInternal(Global::vboxStatusCodeToCOM(vrc),
    654                                    this->getClassIID(),
    655                                    this->getComponentName(),
    656                                    Utf8Str(pcszMsgFmt, va),
    657                                    false /* aWarning */,
    658                                    true /* aLogIt */,
    659                                    vrc /* aResultDetail */);
     707    HRESULT hrc = setErrorInternalV(Global::vboxStatusCodeToCOM(vrc),
     708                                    this->getClassIID(),
     709                                    this->getComponentName(),
     710                                    pcszMsgFmt, va,
     711                                    false /* aWarning */,
     712                                    true /* aLogIt */,
     713                                    vrc /* aResultDetail */);
    660714    va_end(va);
    661715    return hrc;
     
    676730HRESULT VirtualBoxBase::setErrorBoth(HRESULT hrc, int vrc)
    677731{
    678     return setErrorInternal(hrc,
    679                             this->getClassIID(),
    680                             this->getComponentName(),
    681                             Utf8StrFmt("%Rrc", vrc),
    682                             false /* aWarning */,
    683                             true /* aLogIt */,
    684                             vrc /* aResultDetail */);
     732    return setErrorInternalF(hrc,
     733                             this->getClassIID(),
     734                             this->getComponentName(),
     735                             false /* aWarning */,
     736                             true /* aLogIt */,
     737                             vrc /* aResultDetail */,
     738                             Utf8StrFmt("%Rrc", vrc).c_str());
    685739}
    686740
     
    703757    va_list va;
    704758    va_start(va, pcszMsgFmt);
    705     hrc = setErrorInternal(hrc,
    706                            this->getClassIID(),
    707                            this->getComponentName(),
    708                            Utf8Str(pcszMsgFmt, va),
    709                            false /* aWarning */,
    710                            true /* aLogIt */,
    711                            vrc /* aResultDetail */);
     759    hrc = setErrorInternalV(hrc,
     760                            this->getClassIID(),
     761                            this->getComponentName(),
     762                            pcszMsgFmt, va,
     763                            false /* aWarning */,
     764                            true /* aLogIt */,
     765                            vrc /* aResultDetail */);
    712766    va_end(va);
    713767    return hrc;
     
    724778    va_list args;
    725779    va_start(args, pcsz);
    726     HRESULT rc = setErrorInternal(aResultCode,
    727                                   this->getClassIID(),
    728                                   this->getComponentName(),
    729                                   Utf8Str(pcsz, args),
    730                                   true /* aWarning */,
    731                                   true /* aLogIt */);
     780    HRESULT rc = setErrorInternalV(aResultCode,
     781                                   this->getClassIID(),
     782                                   this->getComponentName(),
     783                                   pcsz, args,
     784                                   true /* aWarning */,
     785                                   true /* aLogIt */);
    732786    va_end(args);
    733787    return rc;
     
    744798    va_list args;
    745799    va_start(args, pcsz);
    746     HRESULT rc = setErrorInternal(aResultCode,
    747                                   this->getClassIID(),
    748                                   this->getComponentName(),
    749                                   Utf8Str(pcsz, args),
    750                                   false /* aWarning */,
    751                                   false /* aLogIt */);
     800    HRESULT rc = setErrorInternalV(aResultCode,
     801                                   this->getClassIID(),
     802                                   this->getComponentName(),
     803                                   pcsz, args,
     804                                   false /* aWarning */,
     805                                   false /* aLogIt */);
    752806    va_end(args);
    753807    return rc;
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r89953 r90828  
    32223222    va_list args;
    32233223    va_start(args, pcsz);
    3224     HRESULT rc = setErrorInternal(aResultCode,
    3225                                   getStaticClassIID(),
    3226                                   getStaticComponentName(),
    3227                                   Utf8Str(pcsz, args),
    3228                                   false /* aWarning */,
    3229                                   true /* aLogIt */);
     3224    HRESULT rc = setErrorInternalV(aResultCode,
     3225                                   getStaticClassIID(),
     3226                                   getStaticComponentName(),
     3227                                   pcsz, args,
     3228                                   false /* aWarning */,
     3229                                   true /* aLogIt */);
    32303230    va_end(args);
    32313231    return rc;
     
    32373237    va_list args;
    32383238    va_start(args, pcsz);
    3239     HRESULT rc = setErrorInternal(aResultCode,
    3240                                   getStaticClassIID(),
    3241                                   getStaticComponentName(),
    3242                                   Utf8Str(pcsz, args),
    3243                                   false /* aWarning */,
    3244                                   true /* aLogIt */,
    3245                                   vrc);
     3239    HRESULT rc = setErrorInternalV(aResultCode,
     3240                                   getStaticClassIID(),
     3241                                   getStaticComponentName(),
     3242                                   pcsz, args,
     3243                                   false /* aWarning */,
     3244                                   true /* aLogIt */,
     3245                                   vrc);
    32463246    va_end(args);
    32473247    return rc;
     
    33543354            mVMStateChangeCallbackDisabled = false;
    33553355            if (RT_FAILURE(vrc))
    3356                 return setErrorInternal(VBOX_E_INVALID_VM_STATE,
    3357                                         COM_IIDOF(IConsole),
    3358                                         getStaticComponentName(),
    3359                                         Utf8StrFmt("Could suspend VM for medium change (%Rrc)", vrc),
    3360                                         false /*aWarning*/,
    3361                                         true /*aLogIt*/,
    3362                                         vrc);
     3356                return setErrorInternalF(VBOX_E_INVALID_VM_STATE,
     3357                                         COM_IIDOF(IConsole),
     3358                                         getStaticComponentName(),
     3359                                         false /*aWarning*/,
     3360                                         true /*aLogIt*/,
     3361                                         vrc,
     3362                                         tr("Could suspend VM for medium change (%Rrc)"), vrc);
    33633363            *pfResume = true;
    33643364            break;
     
    33673367            break;
    33683368        default:
    3369             return setErrorInternal(VBOX_E_INVALID_VM_STATE,
    3370                                     COM_IIDOF(IConsole),
    3371                                     getStaticComponentName(),
    3372                                     Utf8StrFmt("Invalid state '%s' for changing medium",
    3373                                                VMR3GetStateName(enmVMState)),
    3374                                     false /*aWarning*/,
    3375                                     true /*aLogIt*/);
     3369            return setErrorInternalF(VBOX_E_INVALID_VM_STATE,
     3370                                     COM_IIDOF(IConsole),
     3371                                     getStaticComponentName(),
     3372                                     false /*aWarning*/,
     3373                                     true /*aLogIt*/,
     3374                                     0 /* aResultDetail */,
     3375                                     "Invalid state '%s' for changing medium",
     3376                                     VMR3GetStateName(enmVMState));
    33763377    }
    33773378
  • trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp

    r90790 r90828  
    32003200        if (RT_FAILURE(vrc))
    32013201        {
    3202             mConsole->setErrorBoth(E_FAIL, vrc, mConsole->tr("Could not load the external authentication library '%s' (%Rrc)"),
     3202            mConsole->setErrorBoth(E_FAIL, vrc, tr("Could not load the external authentication library '%s' (%Rrc)"),
    32033203                                   filename.c_str(), vrc);
    32043204            return AuthResultAccessDenied;
  • trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp

    r85746 r90828  
    346346    {
    347347        hr = m_pProgress->init(static_cast<IGuest *>(pParent),
    348                                Bstr(pParent->tr("Dropping data")).raw(),
     348                               Bstr(tr("Dropping data")).raw(),
    349349                               TRUE /* aCancelable */);
    350350    }
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r85300 r90828  
    26112611    {
    26122612        case VERR_ACCESS_DENIED:
    2613             strErr = Utf8StrFmt(Guest::tr("Access to \"%s\" denied"), guestErrorInfo.getWhat().c_str());
     2613            strErr = Utf8StrFmt(tr("Access to \"%s\" denied"), guestErrorInfo.getWhat().c_str());
    26142614            break;
    26152615
     
    26172617            RT_FALL_THROUGH();
    26182618        case VERR_PATH_NOT_FOUND:
    2619             strErr = Utf8StrFmt(Guest::tr("No such file or directory \"%s\""), guestErrorInfo.getWhat().c_str());
     2619            strErr = Utf8StrFmt(tr("No such file or directory \"%s\""), guestErrorInfo.getWhat().c_str());
    26202620            break;
    26212621
    26222622        case VERR_INVALID_VM_HANDLE:
    2623             strErr = Utf8StrFmt(Guest::tr("VMM device is not available (is the VM running?)"));
     2623            strErr = Utf8StrFmt(tr("VMM device is not available (is the VM running?)"));
    26242624            break;
    26252625
    26262626        case VERR_HGCM_SERVICE_NOT_FOUND:
    2627             strErr = Utf8StrFmt(Guest::tr("The guest execution service is not available"));
     2627            strErr = Utf8StrFmt(tr("The guest execution service is not available"));
    26282628            break;
    26292629
    26302630        case VERR_BAD_EXE_FORMAT:
    2631             strErr = Utf8StrFmt(Guest::tr("The file \"%s\" is not an executable format"),
     2631            strErr = Utf8StrFmt(tr("The file \"%s\" is not an executable format"),
    26322632                                guestErrorInfo.getWhat().c_str());
    26332633            break;
    26342634
    26352635        case VERR_AUTHENTICATION_FAILURE:
    2636             strErr = Utf8StrFmt(Guest::tr("The user \"%s\" was not able to logon"), guestErrorInfo.getWhat().c_str());
     2636            strErr = Utf8StrFmt(tr("The user \"%s\" was not able to logon"), guestErrorInfo.getWhat().c_str());
    26372637            break;
    26382638
    26392639        case VERR_INVALID_NAME:
    2640             strErr = Utf8StrFmt(Guest::tr("The file \"%s\" is an invalid name"), guestErrorInfo.getWhat().c_str());
     2640            strErr = Utf8StrFmt(tr("The file \"%s\" is an invalid name"), guestErrorInfo.getWhat().c_str());
    26412641            break;
    26422642
    26432643        case VERR_TIMEOUT:
    2644             strErr = Utf8StrFmt(Guest::tr("The guest did not respond within time"));
     2644            strErr = Utf8StrFmt(tr("The guest did not respond within time"));
    26452645            break;
    26462646
    26472647        case VERR_CANCELLED:
    2648             strErr = Utf8StrFmt(Guest::tr("The execution operation was canceled"));
     2648            strErr = Utf8StrFmt(tr("The execution operation was canceled"));
    26492649            break;
    26502650
    26512651        case VERR_GSTCTL_MAX_CID_OBJECTS_REACHED:
    2652             strErr = Utf8StrFmt(Guest::tr("Maximum number of concurrent guest processes has been reached"));
     2652            strErr = Utf8StrFmt(tr("Maximum number of concurrent guest processes has been reached"));
    26532653            break;
    26542654
    26552655        case VERR_NOT_FOUND:
    2656             strErr = Utf8StrFmt(Guest::tr("The guest execution service is not ready (yet)"));
     2656            strErr = Utf8StrFmt(tr("The guest execution service is not ready (yet)"));
    26572657            break;
    26582658
    26592659        default:
    2660             strErr = Utf8StrFmt(Guest::tr("Unhandled error %Rrc for \"%s\" occurred for tool \"%s\" on guest -- please file a bug report"),
     2660            strErr = Utf8StrFmt(tr("Unhandled error %Rrc for \"%s\" occurred for tool \"%s\" on guest -- please file a bug report"),
    26612661                                guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str(), pszTool);
    26622662            break;
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r84975 r90828  
    267267        {
    268268            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    269                                 Utf8StrFmt(GuestSession::tr("Guest directory \"%s\" already exists"), strPath.c_str()));
     269                                Utf8StrFmt(tr("Guest directory \"%s\" already exists"), strPath.c_str()));
    270270            rc = VERR_ALREADY_EXISTS;
    271271        }
     
    292292                if (RT_FAILURE(rc))
    293293                    setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    294                                         Utf8StrFmt(GuestSession::tr("Guest error creating directory \"%s\" on the guest: %Rrc"),
     294                                        Utf8StrFmt(tr("Guest error creating directory \"%s\" on the guest: %Rrc"),
    295295                                                   strPath.c_str(), rcGuest));
    296296                break;
     
    299299            default:
    300300                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    301                                     Utf8StrFmt(GuestSession::tr("Host error creating directory \"%s\" on the guest: %Rrc"),
     301                                    Utf8StrFmt(tr("Host error creating directory \"%s\" on the guest: %Rrc"),
    302302                                               strPath.c_str(), rc));
    303303                break;
     
    330330            {
    331331                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    332                                     Utf8StrFmt(GuestSession::tr("Host directory \"%s\" already exists"), strPath.c_str()));
     332                                    Utf8StrFmt(tr("Host directory \"%s\" already exists"), strPath.c_str()));
    333333            }
    334334            else
     
    337337        else
    338338            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    339                                 Utf8StrFmt(GuestSession::tr("Could not create host directory \"%s\": %Rrc"),
     339                                Utf8StrFmt(tr("Could not create host directory \"%s\": %Rrc"),
    340340                                           strPath.c_str(), rc));
    341341    }
     
    378378        {
    379379            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    380                                 Utf8StrFmt(GuestSession::tr("Seeking to offset %RU64 of guest file \"%s\" failed: %Rrc"),
     380                                Utf8StrFmt(tr("Seeking to offset %RU64 of guest file \"%s\" failed: %Rrc"),
    381381                                           offCopy, strSrcFile.c_str(), rc));
    382382            return rc;
     
    393393        {
    394394            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    395                                 Utf8StrFmt(GuestSession::tr("Reading %RU32 bytes @ %RU64 from guest \"%s\" failed: %Rrc"),
     395                                Utf8StrFmt(tr("Reading %RU32 bytes @ %RU64 from guest \"%s\" failed: %Rrc"),
    396396                                           cbChunk, cbWrittenTotal, strSrcFile.c_str(), rc));
    397397            break;
     
    402402        {
    403403            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    404                                 Utf8StrFmt(GuestSession::tr("Writing %RU32 bytes to host file \"%s\" failed: %Rrc"),
     404                                Utf8StrFmt(tr("Writing %RU32 bytes to host file \"%s\" failed: %Rrc"),
    405405                                           cbRead, strDstFile.c_str(), rc));
    406406            break;
     
    441441         * to the destination -> access denied. */
    442442        setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    443                             Utf8StrFmt(GuestSession::tr("Writing guest file \"%s\" to host file \"%s\" failed: Access denied"),
     443                            Utf8StrFmt(tr("Writing guest file \"%s\" to host file \"%s\" failed: Access denied"),
    444444                                       strSrcFile.c_str(), strDstFile.c_str()));
    445445        rc = VERR_ACCESS_DENIED;
     
    449449        /* If we did not copy all let the user know. */
    450450        setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    451                             Utf8StrFmt(GuestSession::tr("Copying guest file \"%s\" to host file \"%s\" failed (%RU64/%RU64 bytes transfered)"),
     451                            Utf8StrFmt(tr("Copying guest file \"%s\" to host file \"%s\" failed (%RU64/%RU64 bytes transfered)"),
    452452                                       strSrcFile.c_str(), strDstFile.c_str(), cbWrittenTotal, cbSize));
    453453        rc = VERR_INTERRUPTED;
     
    484484    {
    485485        if (rc == VERR_GSTCTL_GUEST_ERROR)
    486             setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Guest file lookup failed"),
     486            setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Guest file lookup failed"),
    487487                                GuestErrorInfo(GuestErrorInfo::Type_ToolStat, rcGuest, strSrc.c_str()));
    488488        else
    489489            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    490                                 Utf8StrFmt(GuestSession::tr("Guest file lookup for \"%s\" failed: %Rrc"), strSrc.c_str(), rc));
     490                                Utf8StrFmt(tr("Guest file lookup for \"%s\" failed: %Rrc"), strSrc.c_str(), rc));
    491491    }
    492492    else
     
    501501                {
    502502                    setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    503                                         Utf8StrFmt(GuestSession::tr("Guest file \"%s\" is a symbolic link"),
     503                                        Utf8StrFmt(tr("Guest file \"%s\" is a symbolic link"),
    504504                                                   strSrc.c_str()));
    505505                    rc = VERR_IS_A_SYMLINK;
     
    509509            default:
    510510                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    511                                     Utf8StrFmt(GuestSession::tr("Guest object \"%s\" is not a file (is type %#x)"),
     511                                    Utf8StrFmt(tr("Guest object \"%s\" is not a file (is type %#x)"),
    512512                                               strSrc.c_str(), srcObjData.mType));
    513513                rc = VERR_NOT_A_FILE;
     
    523523    {
    524524        if (rc == VERR_GSTCTL_GUEST_ERROR)
    525             setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Guest file could not be opened"),
     525            setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Guest file could not be opened"),
    526526                                GuestErrorInfo(GuestErrorInfo::Type_File, rcGuest, strSrc.c_str()));
    527527        else
    528528            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    529                                 Utf8StrFmt(GuestSession::tr("Guest file \"%s\" could not be opened: %Rrc"), strSrc.c_str(), rc));
     529                                Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"), strSrc.c_str(), rc));
    530530    }
    531531
     
    546546            {
    547547                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    548                                     Utf8StrFmt(GuestSession::tr("Host file \"%s\" already exists"), strDst.c_str()));
     548                                    Utf8StrFmt(tr("Host file \"%s\" already exists"), strDst.c_str()));
    549549                rc = VERR_ALREADY_EXISTS;
    550550            }
     
    565565            if (rc != VERR_FILE_NOT_FOUND) /* Destination file does not exist (yet)? */
    566566                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    567                                     Utf8StrFmt(GuestSession::tr("Host file lookup for \"%s\" failed: %Rrc"),
     567                                    Utf8StrFmt(tr("Host file lookup for \"%s\" failed: %Rrc"),
    568568                                               strDst.c_str(), rc));
    569569        }
     
    586586            {
    587587                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    588                                     Utf8StrFmt(GuestSession::tr("Host file \"%s\" already exists"), strDst.c_str()));
     588                                    Utf8StrFmt(tr("Host file \"%s\" already exists"), strDst.c_str()));
    589589                rc = VERR_ALREADY_EXISTS;
    590590            }
     
    609609            {
    610610                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    611                                     Utf8StrFmt(GuestSession::tr("Host file \"%s\" is a symbolic link"),
     611                                    Utf8StrFmt(tr("Host file \"%s\" is a symbolic link"),
    612612                                               strDst.c_str()));
    613613                rc = VERR_IS_A_SYMLINK;
     
    630630        if (!pszDstFile)
    631631        {
    632             setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt(GuestSession::tr("No memory to allocate host file path")));
     632            setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt(tr("No memory to allocate host file path")));
    633633            rc = VERR_NO_MEMORY;
    634634        }
     
    651651            else
    652652                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    653                                     Utf8StrFmt(GuestSession::tr("Opening/creating host file \"%s\" failed: %Rrc"),
     653                                    Utf8StrFmt(tr("Opening/creating host file \"%s\" failed: %Rrc"),
    654654                                               pszDstFile, rc));
    655655        }
     
    698698        {
    699699            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    700                                 Utf8StrFmt(GuestSession::tr("Seeking to offset %RU64 of host file \"%s\" failed: %Rrc"),
     700                                Utf8StrFmt(tr("Seeking to offset %RU64 of host file \"%s\" failed: %Rrc"),
    701701                                           offCopy, strSrcFile.c_str(), rc));
    702702            return rc;
     
    713713        {
    714714            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    715                                 Utf8StrFmt(GuestSession::tr("Reading %RU32 bytes @ %RU64 from host file \"%s\" failed: %Rrc"),
     715                                Utf8StrFmt(tr("Reading %RU32 bytes @ %RU64 from host file \"%s\" failed: %Rrc"),
    716716                                           cbChunk, cbWrittenTotal, strSrcFile.c_str(), rc));
    717717            break;
     
    722722        {
    723723            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    724                                 Utf8StrFmt(GuestSession::tr("Writing %zu bytes to guest file \"%s\" failed: %Rrc"),
     724                                Utf8StrFmt(tr("Writing %zu bytes to guest file \"%s\" failed: %Rrc"),
    725725                                           cbRead, strDstFile.c_str(), rc));
    726726            break;
     
    757757         * to the destination -> access denied. */
    758758        setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    759                             Utf8StrFmt(GuestSession::tr("Writing to guest file \"%s\" failed: Access denied"),
     759                            Utf8StrFmt(tr("Writing to guest file \"%s\" failed: Access denied"),
    760760                                       strDstFile.c_str()));
    761761        rc = VERR_ACCESS_DENIED;
     
    765765        /* If we did not copy all let the user know. */
    766766        setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    767                             Utf8StrFmt(GuestSession::tr("Copying to guest file \"%s\" failed (%RU64/%RU64 bytes transfered)"),
     767                            Utf8StrFmt(tr("Copying to guest file \"%s\" failed (%RU64/%RU64 bytes transfered)"),
    768768                                       strDstFile.c_str(), cbWrittenTotal, cbSize));
    769769        rc = VERR_INTERRUPTED;
     
    803803    {
    804804        if (rc == VERR_GSTCTL_GUEST_ERROR)
    805             setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Guest file could not be opened"),
     805            setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Guest file could not be opened"),
    806806                                GuestErrorInfo(GuestErrorInfo::Type_File, rcGuest, strSrc.c_str()));
    807807        else
    808808            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    809                                 Utf8StrFmt(GuestSession::tr("Guest file \"%s\" could not be opened: %Rrc"), strSrc.c_str(), rc));
     809                                Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"), strSrc.c_str(), rc));
    810810        return rc;
    811811    }
     
    824824        {
    825825            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    826                                 Utf8StrFmt(GuestSession::tr("Host path lookup for file \"%s\" failed: %Rrc"),
     826                                Utf8StrFmt(tr("Host path lookup for file \"%s\" failed: %Rrc"),
    827827                                           strSrc.c_str(), rc));
    828828        }
     
    860860                                default:
    861861                                    setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    862                                                         Utf8StrFmt(GuestSession::tr("Guest error while determining object data for guest file \"%s\": %Rrc"),
     862                                                        Utf8StrFmt(tr("Guest error while determining object data for guest file \"%s\": %Rrc"),
    863863                                                           strDstFinal.c_str(), rcGuest));
    864864                                    break;
     
    867867                        else
    868868                            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    869                                                 Utf8StrFmt(GuestSession::tr("Host error while determining object data for guest file \"%s\": %Rrc"),
     869                                                Utf8StrFmt(tr("Host error while determining object data for guest file \"%s\": %Rrc"),
    870870                                                           strDstFinal.c_str(), rc));
    871871                    }
     
    875875            {
    876876                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    877                                     Utf8StrFmt(GuestSession::tr("Host file lookup for \"%s\" failed: %Rrc"),
     877                                    Utf8StrFmt(tr("Host file lookup for \"%s\" failed: %Rrc"),
    878878                                               szSrcReal, rc));
    879879            }
     
    905905        else
    906906            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    907                                 Utf8StrFmt(GuestSession::tr("Opening host file \"%s\" failed: %Rrc"),
     907                                Utf8StrFmt(tr("Opening host file \"%s\" failed: %Rrc"),
    908908                                           szSrcReal, rc));
    909909    }
     
    14091409    if (mDest.isEmpty())
    14101410    {
    1411         strErrorInfo = Utf8StrFmt(GuestSession::tr("Host destination must not be empty"));
     1411        strErrorInfo = Utf8StrFmt(tr("Host destination must not be empty"));
    14121412        vrc = VERR_INVALID_PARAMETER;
    14131413    }
     
    14241424            if (strSrc.isEmpty())
    14251425            {
    1426                 strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest source entry must not be empty"));
     1426                strErrorInfo = Utf8StrFmt(tr("Guest source entry must not be empty"));
    14271427                vrc = VERR_INVALID_PARAMETER;
    14281428                break;
     
    14581458            {
    14591459                if (vrc == VERR_GSTCTL_GUEST_ERROR)
    1460                     strErrorInfo = GuestBase::getErrorAsString(GuestSession::tr("Guest file lookup failed"),
     1460                    strErrorInfo = GuestBase::getErrorAsString(tr("Guest file lookup failed"),
    14611461                                                               GuestErrorInfo(GuestErrorInfo::Type_ToolStat, rcGuest, strSrc.c_str()));
    14621462                else
    1463                     strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest file lookup for \"%s\" failed: %Rrc"),
     1463                    strErrorInfo = Utf8StrFmt(tr("Guest file lookup for \"%s\" failed: %Rrc"),
    14641464                                              strSrc.c_str(), vrc);
    14651465                break;
     
    14701470                if (itSrc->enmType != FsObjType_Directory)
    14711471                {
    1472                     strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest source is not a file: %s"), strSrc.c_str());
     1472                    strErrorInfo = Utf8StrFmt(tr("Guest source is not a file: %s"), strSrc.c_str());
    14731473                    vrc = VERR_NOT_A_FILE;
    14741474                    break;
     
    14791479                if (itSrc->enmType != FsObjType_File)
    14801480                {
    1481                     strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest source is not a directory: %s"), strSrc.c_str());
     1481                    strErrorInfo = Utf8StrFmt(tr("Guest source is not a directory: %s"), strSrc.c_str());
    14821482                    vrc = VERR_NOT_A_DIRECTORY;
    14831483                    break;
     
    15011501                {
    15021502                    delete pFsList;
    1503                     strErrorInfo = Utf8StrFmt(GuestSession::tr("Error adding guest source '%s' to list: %Rrc"),
     1503                    strErrorInfo = Utf8StrFmt(tr("Error adding guest source '%s' to list: %Rrc"),
    15041504                                              strSrc.c_str(), vrc);
    15051505                    break;
     
    15371537    {
    15381538        if (strErrorInfo.isEmpty())
    1539             strErrorInfo = Utf8StrFmt(GuestSession::tr("Failed with %Rrc"), vrc);
     1539            strErrorInfo = Utf8StrFmt(tr("Failed with %Rrc"), vrc);
    15401540        setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo);
    15411541    }
     
    16791679    if (mDest.isEmpty())
    16801680    {
    1681         strErrorInfo = Utf8StrFmt(GuestSession::tr("Guest destination must not be empty"));
     1681        strErrorInfo = Utf8StrFmt(tr("Guest destination must not be empty"));
    16821682        rc = VERR_INVALID_PARAMETER;
    16831683    }
     
    16941694            if (strSrc.isEmpty())
    16951695            {
    1696                 strErrorInfo = Utf8StrFmt(GuestSession::tr("Host source entry must not be empty"));
     1696                strErrorInfo = Utf8StrFmt(tr("Host source entry must not be empty"));
    16971697                rc = VERR_INVALID_PARAMETER;
    16981698                break;
     
    17031703            if (RT_FAILURE(rc))
    17041704            {
    1705                 strErrorInfo = Utf8StrFmt(GuestSession::tr("No such host file/directory: %s"), strSrc.c_str());
     1705                strErrorInfo = Utf8StrFmt(tr("No such host file/directory: %s"), strSrc.c_str());
    17061706                break;
    17071707            }
     
    17111711                if (itSrc->enmType != FsObjType_Directory)
    17121712                {
    1713                     strErrorInfo = Utf8StrFmt(GuestSession::tr("Host source is not a file: %s"), strSrc.c_str());
     1713                    strErrorInfo = Utf8StrFmt(tr("Host source is not a file: %s"), strSrc.c_str());
    17141714                    rc = VERR_NOT_A_FILE;
    17151715                    break;
     
    17201720                if (itSrc->enmType == FsObjType_Directory)
    17211721                {
    1722                     strErrorInfo = Utf8StrFmt(GuestSession::tr("Host source is not a directory: %s"), strSrc.c_str());
     1722                    strErrorInfo = Utf8StrFmt(tr("Host source is not a directory: %s"), strSrc.c_str());
    17231723                    rc = VERR_NOT_A_DIRECTORY;
    17241724                    break;
     
    17441744                {
    17451745                    delete pFsList;
    1746                     strErrorInfo = Utf8StrFmt(GuestSession::tr("Error adding host source '%s' to list: %Rrc"),
     1746                    strErrorInfo = Utf8StrFmt(tr("Error adding host source '%s' to list: %Rrc"),
    17471747                                              strSrc.c_str(), rc);
    17481748                    break;
     
    17801780    {
    17811781        if (strErrorInfo.isEmpty())
    1782             strErrorInfo = Utf8StrFmt(GuestSession::tr("Failed with %Rrc"), rc);
     1782            strErrorInfo = Utf8StrFmt(tr("Failed with %Rrc"), rc);
    17831783        setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo);
    17841784    }
     
    18271827                    default:
    18281828                        setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    1829                                             Utf8StrFmt(GuestSession::tr("Querying information on for '%s' failed: %Rrc"),
     1829                                            Utf8StrFmt(tr("Querying information on for '%s' failed: %Rrc"),
    18301830                                            strDstRootAbs.c_str(), rcGuest));
    18311831                        break;
     
    18351835            {
    18361836                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    1837                                     Utf8StrFmt(GuestSession::tr("Querying information on guest for '%s' failed: %Rrc"),
     1837                                    Utf8StrFmt(tr("Querying information on guest for '%s' failed: %Rrc"),
    18381838                                               strDstRootAbs.c_str(), rc));
    18391839                break;
     
    18691869                {
    18701870                    setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    1871                                         Utf8StrFmt(GuestSession::tr("Guest directory \"%s\" already exists"),
     1871                                        Utf8StrFmt(tr("Guest directory \"%s\" already exists"),
    18721872                                                   strDstRootAbs.c_str()));
    18731873                    rc = VERR_ALREADY_EXISTS;
     
    20752075                    default:
    20762076                        setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2077                                             Utf8StrFmt(GuestSession::tr("Guest file \"%s\" could not be opened: %Rrc"),
     2077                                            Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"),
    20782078                                                       strFileDst.c_str(), rc));
    20792079                        break;
     
    21282128            case VERR_GSTCTL_PROCESS_EXIT_CODE:
    21292129                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2130                                     Utf8StrFmt(GuestSession::tr("Running update file \"%s\" on guest failed: %Rrc"),
     2130                                    Utf8StrFmt(tr("Running update file \"%s\" on guest failed: %Rrc"),
    21312131                                               procInfo.mExecutable.c_str(), procTool.getRc()));
    21322132                break;
    21332133
    21342134            case VERR_GSTCTL_GUEST_ERROR:
    2135                 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Running update file on guest failed"),
     2135                setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Running update file on guest failed"),
    21362136                                    GuestErrorInfo(GuestErrorInfo::Type_Process, rcGuest, procInfo.mExecutable.c_str()));
    21372137                break;
     
    21392139            case VERR_INVALID_STATE: /** @todo Special guest control rc needed! */
    21402140                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2141                                     Utf8StrFmt(GuestSession::tr("Update file \"%s\" reported invalid running state"),
     2141                                    Utf8StrFmt(tr("Update file \"%s\" reported invalid running state"),
    21422142                                               procInfo.mExecutable.c_str()));
    21432143                break;
     
    21452145            default:
    21462146                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2147                                     Utf8StrFmt(GuestSession::tr("Error while running update file \"%s\" on guest: %Rrc"),
     2147                                    Utf8StrFmt(tr("Error while running update file \"%s\" on guest: %Rrc"),
    21482148                                               procInfo.mExecutable.c_str(), vrc));
    21492149                break;
     
    21952195    if (rc == VERR_TIMEOUT)
    21962196        hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2197                                  Utf8StrFmt(GuestSession::tr("Guest Additions were not ready within time, giving up")));
     2197                                 Utf8StrFmt(tr("Guest Additions were not ready within time, giving up")));
    21982198#else
    21992199    /*
     
    22082208        if (addsRunLevel == AdditionsRunLevelType_System)
    22092209            hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2210                                      Utf8StrFmt(GuestSession::tr("Guest Additions are installed but not fully loaded yet, aborting automatic update")));
     2210                                     Utf8StrFmt(tr("Guest Additions are installed but not fully loaded yet, aborting automatic update")));
    22112211        else
    22122212            hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2213                                      Utf8StrFmt(GuestSession::tr("Guest Additions not installed or ready, aborting automatic update")));
     2213                                     Utf8StrFmt(tr("Guest Additions not installed or ready, aborting automatic update")));
    22142214        rc = VERR_NOT_SUPPORTED;
    22152215    }
     
    22282228        {
    22292229            hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2230                                      Utf8StrFmt(GuestSession::tr("Guest has too old Guest Additions (%s) installed for automatic updating, please update manually"),
     2230                                     Utf8StrFmt(tr("Guest has too old Guest Additions (%s) installed for automatic updating, please update manually"),
    22312231                                                strAddsVer.c_str()));
    22322232            rc = VERR_NOT_SUPPORTED;
     
    22572257                {
    22582258                    hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2259                                              Utf8StrFmt(GuestSession::tr("Unable to detected guest OS version, please update manually")));
     2259                                             Utf8StrFmt(tr("Unable to detected guest OS version, please update manually")));
    22602260                    rc = VERR_NOT_SUPPORTED;
    22612261                }
     
    22772277                        {
    22782278                            hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2279                                                      Utf8StrFmt(GuestSession::tr("Windows 2000 and XP are not supported for automatic updating due to WHQL interaction, please update manually")));
     2279                                                     Utf8StrFmt(tr("Windows 2000 and XP are not supported for automatic updating due to WHQL interaction, please update manually")));
    22802280                            rc = VERR_NOT_SUPPORTED;
    22812281                        }
     
    22852285                {
    22862286                    hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2287                                              Utf8StrFmt(GuestSession::tr("%s (%s) not supported for automatic updating, please update manually"),
     2287                                             Utf8StrFmt(tr("%s (%s) not supported for automatic updating, please update manually"),
    22882288                                                        strOSType.c_str(), strOSVer.c_str()));
    22892289                    rc = VERR_NOT_SUPPORTED;
     
    23032303            {
    23042304                hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
    2305                                          Utf8StrFmt(GuestSession::tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"),
     2305                                         Utf8StrFmt(tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"),
    23062306                                                    strOSType.c_str()));
    23072307                rc = VERR_NOT_SUPPORTED;
     
    23202320        {
    23212321            hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2322                                          Utf8StrFmt(GuestSession::tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"),
     2322                                         Utf8StrFmt(tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"),
    23232323                                         mSource.c_str(), rc));
    23242324        }
     
    23302330            {
    23312331                hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2332                                          Utf8StrFmt(GuestSession::tr("Unable to open file as ISO 9660 file system volume: %Rrc"), rc));
     2332                                         Utf8StrFmt(tr("Unable to open file as ISO 9660 file system volume: %Rrc"), rc));
    23332333            }
    23342334            else
     
    23982398                        {
    23992399                            case VERR_GSTCTL_GUEST_ERROR:
    2400                                 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Creating installation directory on guest failed"),
     2400                                hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Creating installation directory on guest failed"),
    24012401                                                         GuestErrorInfo(GuestErrorInfo::Type_Directory, rcGuest, strUpdateDir.c_str()));
    24022402                                break;
     
    24042404                            default:
    24052405                                hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2406                                                          Utf8StrFmt(GuestSession::tr("Creating installation directory \"%s\" on guest failed: %Rrc"),
     2406                                                         Utf8StrFmt(tr("Creating installation directory \"%s\" on guest failed: %Rrc"),
    24072407                                                                    strUpdateDir.c_str(), rc));
    24082408                                break;
     
    25912591                            {
    25922592                                hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2593                                                          Utf8StrFmt(GuestSession::tr("Error while copying file \"%s\" to \"%s\" on the guest: %Rrc"),
     2593                                                         Utf8StrFmt(tr("Error while copying file \"%s\" to \"%s\" on the guest: %Rrc"),
    25942594                                                                    itFiles->strSource.c_str(), itFiles->strDest.c_str(), rc));
    25952595                                break;
     
    26552655
    26562656            hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2657                                      Utf8StrFmt(GuestSession::tr("Installation was canceled")));
     2657                                     Utf8StrFmt(tr("Installation was canceled")));
    26582658        }
    26592659        else
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r89951 r90828  
    3737public:
    3838
    39     DECLARE_EMPTY_CTOR_DTOR(MousePointerShape)
     39    DECLARE_COMMON_CLASS_METHODS(MousePointerShape)
    4040
    4141    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp

    r85489 r90828  
    2424#include "VBoxEvents.h"
    2525#include "VBox/com/ErrorInfo.h"
     26#include "VBox/com/listeners.h"
    2627
    2728#include <iprt/asm.h>
     
    4849LONG VirtualBoxClient::s_cUnnecessaryAtlModuleLocks = 0;
    4950
     51#ifdef VBOX_WITH_MAIN_NLS
     52
     53/* listener class for language updates */
     54class VBoxEventListener
     55{
     56public:
     57    VBoxEventListener()
     58    {}
     59
     60
     61    HRESULT init(VirtualBoxClient *aClient)
     62    {
     63        mClient = aClient;
     64        return S_OK;
     65    }
     66
     67    void uninit()
     68    {
     69    }
     70
     71    virtual ~VBoxEventListener()
     72    {
     73    }
     74
     75    STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent)
     76    {
     77        NOREF(aEvent);
     78        switch(aType)
     79        {
     80            case VBoxEventType_OnLanguageChanged:
     81            {
     82                mClient->i_reloadApiLanguage();
     83                break;
     84            }
     85
     86            default:
     87              AssertFailed();
     88        }
     89
     90        return S_OK;
     91    }
     92private:
     93    ComObjPtr<VirtualBoxClient>    mClient;
     94};
     95
     96typedef ListenerImpl<VBoxEventListener, VirtualBoxClient*> VBoxEventListenerImpl;
     97
     98VBOX_LISTENER_DECLARE(VBoxEventListenerImpl)
     99
     100#endif /* VBOX_WITH_MAIN_NLS */
     101
    50102// constructor / destructor
    51103/////////////////////////////////////////////////////////////////////////////
     
    121173        AssertMsg(s_cUnnecessaryAtlModuleLocks == 1, ("%d\n", s_cUnnecessaryAtlModuleLocks));
    122174
     175#ifdef VBOX_WITH_MAIN_NLS
     176        /* Create the translator singelton (must work) and try load translations (non-fatal). */
     177        mData.m_pVBoxTranslator = VirtualBoxTranslator::instance();
     178        if (mData.m_pVBoxTranslator == NULL)
     179            throw setError(VBOX_E_IPRT_ERROR, tr("Failed to create translator instance"));
     180        rc = i_reloadApiLanguage();
     181        if (SUCCEEDED(rc))
     182            i_registerEventListener(); /* for updates */
     183        else
     184            LogRelFunc(("i_reloadApiLanguage failed: %Rhrc\n", rc));
     185#endif
    123186        /* Setting up the VBoxSVC watcher thread. If anything goes wrong here it
    124187         * is not considered important enough to cause any sort of visible
     
    475538        mData.m_SemEvWatcher = NIL_RTSEMEVENT;
    476539    }
    477 
     540#ifdef VBOX_WITH_MAIN_NLS
     541    if (mData.m_pVBoxTranslator != NULL)
     542    {
     543        mData.m_pVBoxTranslator->release();
     544        mData.m_pVBoxTranslator = NULL;
     545    }
     546#endif
    478547    mData.m_pToken.setNull();
    479548    mData.m_pVirtualBox.setNull();
     
    623692                        pThis->mData.m_pVirtualBox = pVirtualBox;
    624693                        pThis->mData.m_pToken = pToken;
     694#ifdef VBOX_WITH_MAIN_NLS
     695                        /* update language using new instance of IVirtualBox in case the language settings was changed */
     696                        pThis->i_reloadApiLanguage();
     697                        pThis->i_registerEventListener();
     698#endif
    625699                    }
    626700                    ::FireVBoxSVCAvailabilityChangedEvent(pThis->mData.m_pEventSource, TRUE);
     
    634708}
    635709
     710#ifdef VBOX_WITH_MAIN_NLS
     711
     712HRESULT VirtualBoxClient::i_reloadApiLanguage()
     713{
     714    if (mData.m_pVBoxTranslator == NULL)
     715        return S_OK;
     716
     717    HRESULT rc = mData.m_pVBoxTranslator->loadLanguage(mData.m_pVirtualBox);
     718    if (FAILED(rc))
     719        setError(rc, tr("Failed to load user language instance"));
     720    return rc;
     721}
     722
     723HRESULT VirtualBoxClient::i_registerEventListener()
     724{
     725    ComPtr<IEventSource> pES;
     726    HRESULT rc = mData.m_pVirtualBox->COMGETTER(EventSource)(pES.asOutParam());
     727    if (SUCCEEDED(rc))
     728    {
     729        ComObjPtr<VBoxEventListenerImpl> aVBoxListener;
     730        aVBoxListener.createObject();
     731        aVBoxListener->init(new VBoxEventListener(), this);
     732//        mData.m_pVBoxListener = aVBoxListener;
     733        com::SafeArray<VBoxEventType_T> eventTypes;
     734        eventTypes.push_back(VBoxEventType_OnLanguageChanged);
     735        rc = pES->RegisterListener(aVBoxListener, ComSafeArrayAsInParam(eventTypes), true);
     736        if (FAILED(rc))
     737            rc = setError(rc, tr("Failed to register listener"));
     738    }
     739    else
     740        rc = setError(rc, tr("Failed to get event source from VirtualBox"));
     741    return rc;
     742}
     743
     744#endif /* VBOX_WITH_MAIN_NLS */
     745
    636746/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/src-server/DHCPConfigImpl.cpp

    r85234 r90828  
    256256                    mapDuplicates[enmOpt] = true;
    257257                else
    258                     return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Duplicate option value: %d"), (int)enmOpt);
     258                    return m_pHack->setError(E_INVALIDARG, tr("Duplicate option value: %d"), (int)enmOpt);
    259259            }
    260260            else
    261                 return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Invalid option value: %d"), (int)enmOpt);
     261                return m_pHack->setError(E_INVALIDARG, tr("Invalid option value: %d"), (int)enmOpt);
    262262        }
    263263    }
     
    328328                mapNormalized[enmOpt] = true;
    329329            else
    330                 return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Invalid option value: %d"), (int)enmOpt);
     330                return m_pHack->setError(E_INVALIDARG, tr("Invalid option value: %d"), (int)enmOpt);
    331331        }
    332332    }
     
    414414
    415415    if (rc == VERR_WRONG_TYPE)
    416         return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Unsupported encoding %d (option %d, value %s)"),
     416        return m_pHack->setError(E_INVALIDARG, tr("Unsupported encoding %d (option %d, value %s)"),
    417417                                 (int)aEncoding, (int)aOption, aValue.c_str());
    418418    if (rc == VERR_NOT_SUPPORTED)
    419         return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Unsupported option %d (encoding %d, value %s)"),
     419        return m_pHack->setError(E_INVALIDARG, tr("Unsupported option %d (encoding %d, value %s)"),
    420420                                 (int)aOption, (int)aEncoding, aValue.c_str());
    421     return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Malformed option %d value '%s' (encoding %d, rc=%Rrc)"),
     421    return m_pHack->setError(E_INVALIDARG, tr("Malformed option %d value '%s' (encoding %d, rc=%Rrc)"),
    422422                             (int)aOption, aValue.c_str(), (int)aEncoding, rc);
    423423}
     
    432432            m_OptionMap.erase(it);
    433433        else
    434             return m_pHack->setError(VBOX_E_OBJECT_NOT_FOUND, m_pHack->tr("DHCP option %u was not found"), aOption);
     434            return m_pHack->setError(VBOX_E_OBJECT_NOT_FOUND, tr("DHCP option %u was not found"), aOption);
    435435    }
    436436    return i_doWriteConfig();
     
    457457        return aValue.assignEx(it->second.strValue);
    458458    }
    459     return m_pHack->setError(VBOX_E_OBJECT_NOT_FOUND, m_pHack->tr("DHCP option %u was not found"), aOption);
     459    return m_pHack->setError(VBOX_E_OBJECT_NOT_FOUND, tr("DHCP option %u was not found"), aOption);
    460460}
    461461
     
    762762            if (RT_SUCCESS(vrc))
    763763                return S_OK;
    764             return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Not a valid MAC address: %s"), strValue.c_str());
     764            return pErrorDst->setError(E_INVALIDARG, tr("Not a valid MAC address: %s"), strValue.c_str());
    765765        }
    766766
     
    791791                                return S_OK;
    792792                            return pErrorDst->setError(E_INVALIDARG,
    793                                                        pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
     793                                                       tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
    794794                                                       psz, off - 1);
    795795                        }
     
    799799                            return S_OK;
    800800                        return pErrorDst->setError(E_INVALIDARG,
    801                                                    pErrorDst->tr("Malformed MAC wildcard address: %s (offset %zu)"),
     801                                                   tr("Malformed MAC wildcard address: %s (offset %zu)"),
    802802                                                   psz, off - 1);
    803803                    }
     
    814814                        if (cPairsLeft == 0)
    815815                            return pErrorDst->setError(E_INVALIDARG,
    816                                                        pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
     816                                                       tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
    817817                                                       psz, off - 1);
    818818                        if (ch == ':')
     
    820820                    }
    821821                    else
    822                         return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Malformed MAC wildcard address: %s (offset %zu)"),
     822                        return pErrorDst->setError(E_INVALIDARG, tr("Malformed MAC wildcard address: %s (offset %zu)"),
    823823                                                   psz, off - 1);
    824824                }
     
    836836                        if (cPairsLeft == 0)
    837837                            return pErrorDst->setError(E_INVALIDARG,
    838                                                        pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
     838                                                       tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
    839839                                                       psz, off - 1);
    840840                        continue;
     
    843843                }
    844844                else
    845                     return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Malformed MAC wildcard address: %s (offset %zu)"),
     845                    return pErrorDst->setError(E_INVALIDARG, tr("Malformed MAC wildcard address: %s (offset %zu)"),
    846846                                               psz, off - 1);
    847847
     
    864864                        if (cPairsLeft == 0)
    865865                            return pErrorDst->setError(E_INVALIDARG,
    866                                                        pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
     866                                                       tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
    867867                                                       psz, off - 1);
    868868                        continue;
     
    871871                        return S_OK;
    872872                    return pErrorDst->setError(E_INVALIDARG,
    873                                                pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
     873                                               tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),
    874874                                               psz, off - 1);
    875875                }
    876876                return pErrorDst->setError(E_INVALIDARG,
    877                                            pErrorDst->tr("Malformed MAC wildcard address: %s (offset %zu)"),
     877                                           tr("Malformed MAC wildcard address: %s (offset %zu)"),
    878878                                           psz, off - 1);
    879879            }
     
    886886        case DHCPGroupConditionType_userClassIDWildcard:
    887887            if (strValue.length() == 0)
    888                 return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Value cannot be empty"));
     888                return pErrorDst->setError(E_INVALIDARG, tr("Value cannot be empty"));
    889889            if (strValue.length() < 255)
    890                 return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Value is too long: %zu bytes"), strValue.length());
     890                return pErrorDst->setError(E_INVALIDARG, tr("Value is too long: %zu bytes"), strValue.length());
    891891            break;
    892892
    893893        default:
    894             return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Invalid condition type: %d"), enmType);
     894            return pErrorDst->setError(E_INVALIDARG, tr("Invalid condition type: %d"), enmType);
    895895    }
    896896
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r90480 r90828  
    17211721        rc = medium.queryInterfaceTo(aDrive.asOutParam());
    17221722    else
    1723         rc = setError(rc, Medium::tr("The host DVD drive named '%s' could not be found"), aName.c_str());
     1723        rc = setError(rc, tr("The host DVD drive named '%s' could not be found"), aName.c_str());
    17241724    return rc;
    17251725}
     
    17351735        return medium.queryInterfaceTo(aDrive.asOutParam());
    17361736    else
    1737         return setError(rc, Medium::tr("The host floppy drive named '%s' could not be found"), aName.c_str());
     1737        return setError(rc, tr("The host floppy drive named '%s' could not be found"), aName.c_str());
    17381738}
    17391739
     
    17751775    if (!found)
    17761776        return setError(E_INVALIDARG,
    1777                         HostNetworkInterface::tr("The host network interface named '%s' could not be found"), aName.c_str());
     1777                        tr("The host network interface named '%s' could not be found"), aName.c_str());
    17781778
    17791779    return found.queryInterfaceTo(aNetworkInterface.asOutParam());
     
    18181818    if (!found)
    18191819        return setError(E_INVALIDARG,
    1820                         HostNetworkInterface::tr("The host network interface with the given GUID could not be found"));
     1820                        tr("The host network interface with the given GUID could not be found"));
    18211821    return found.queryInterfaceTo(aNetworkInterface.asOutParam());
    18221822
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r89868 r90828  
    1483814838    va_list args;
    1483914839    va_start(args, pcszMsg);
    14840     HRESULT rc = setErrorInternal(aResultCode,
    14841                                   getStaticClassIID(),
    14842                                   getStaticComponentName(),
    14843                                   Utf8Str(pcszMsg, args),
    14844                                   false /* aWarning */,
    14845                                   true /* aLogIt */);
     14840    HRESULT rc = setErrorInternalV(aResultCode,
     14841                                   getStaticClassIID(),
     14842                                   getStaticComponentName(),
     14843                                   pcszMsg, args,
     14844                                   false /* aWarning */,
     14845                                   true /* aLogIt */);
    1484614846    va_end(args);
    1484714847    return rc;
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r82968 r90828  
    6363/////////////////////////////////////////////////////////////////////////////
    6464
    65 struct MachineCloneVMPrivate
     65struct MachineCloneVMPrivate : public VirtualBoxTranslatable
    6666{
    6767    MachineCloneVMPrivate(MachineCloneVM *a_q, ComObjPtr<Machine> &a_pSrcMachine, ComObjPtr<Machine> &a_pTrgMachine,
     
    7474      , options(opts)
    7575    {}
     76
     77    DECLARE_TRANSLATE_METHODS(MachineCloneVMPrivate)
    7678
    7779    /* Thread management */
     
    227229        int vrc = RTFileQuerySizeByPath(fct.strFile.c_str(), &cbSize);
    228230        if (RT_FAILURE(vrc))
    229             return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, p->tr("Could not query file size of '%s' (%Rrc)"),
     231            return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not query file size of '%s' (%Rrc)"),
    230232                                   fct.strFile.c_str(), vrc);
    231233        /* same rule as above: count both the data which needs to
     
    264266        int vrc = RTFileQuerySizeByPath(fct.strFile.c_str(), &cbSize);
    265267        if (RT_FAILURE(vrc))
    266             return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, p->tr("Could not query file size of '%s' (%Rrc)"),
     268            return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not query file size of '%s' (%Rrc)"),
    267269                                   fct.strFile.c_str(), vrc);
    268270        /* same rule as above: count both the data which needs to
     
    10351037        rc = d->pProgress->init(p->i_getVirtualBox(),
    10361038                                static_cast<IMachine*>(d->pSrcMachine) /* aInitiator */,
    1037                                 Bstr(p->tr("Cloning Machine")).raw(),
     1039                                Bstr(tr("Cloning Machine")).raw(),
    10381040                                true /* fCancellable */,
    10391041                                uCount,
    10401042                                uTotalWeight,
    1041                                 Bstr(p->tr("Initialize Cloning")).raw(),
     1043                                Bstr(tr("Initialize Cloning")).raw(),
    10421044                                1);
    10431045        if (FAILED(rc)) throw rc;
     
    11161118            if (!d->findSnapshot(trgMCF.llFirstSnapshot, d->snapshotId, sn))
    11171119                throw p->setError(E_FAIL,
    1118                                   p->tr("Could not find data to snapshots '%s'"), d->snapshotId.toString().c_str());
     1120                                  tr("Could not find data to snapshots '%s'"), d->snapshotId.toString().c_str());
    11191121
    11201122        if (d->mode == CloneMode_MachineState)
     
    11941196                if (FAILED(rc)) throw rc;
    11951197
    1196                 rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(),
     1198                rc = d->pProgress->SetNextOperation(BstrFmt(tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(),
    11971199                                                    mt.uWeight);
    11981200                if (FAILED(rc)) throw rc;
     
    14881490            if (RT_FAILURE(vrc))
    14891491                throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1490                                       p->tr("Could not create snapshots folder '%s' (%Rrc)"),
     1492                                      tr("Could not create snapshots folder '%s' (%Rrc)"),
    14911493                                            strTrgSnapshotFolder.c_str(), vrc);
    14921494        }
     
    14991501
    15001502            /* Move to next sub-operation. */
    1501             rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Copy save state file '%s' ..."),
     1503            rc = d->pProgress->SetNextOperation(BstrFmt(tr("Copy save state file '%s' ..."),
    15021504                                                        RTPathFilename(fct.strFile.c_str())).raw(), fct.uWeight);
    15031505            if (FAILED(rc)) throw rc;
     
    15091511                if (RT_FAILURE(vrc))
    15101512                    throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1511                                           p->tr("Could not copy state file '%s' to '%s' (%Rrc)"),
     1513                                          tr("Could not copy state file '%s' to '%s' (%Rrc)"),
    15121514                                          fct.strFile.c_str(), strTrgSaveState.c_str(), vrc);
    15131515                newFiles.append(strTrgSaveState);
     
    15341536
    15351537            /* Move to next sub-operation. */
    1536             rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Copy NVRAM file '%s' ..."),
     1538            rc = d->pProgress->SetNextOperation(BstrFmt(tr("Copy NVRAM file '%s' ..."),
    15371539                                                        RTPathFilename(fct.strFile.c_str())).raw(), fct.uWeight);
    15381540            if (FAILED(rc)) throw rc;
     
    15461548                if (RT_FAILURE(vrc))
    15471549                    throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1548                                           p->tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"),
     1550                                          tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"),
    15491551                                          fct.strFile.c_str(), strTrgNVRAM.c_str(), vrc);
    15501552                newFiles.append(strTrgNVRAM);
     
    15591561
    15601562        {
    1561             rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Create Machine Clone '%s' ..."),
     1563            rc = d->pProgress->SetNextOperation(BstrFmt(tr("Create Machine Clone '%s' ..."),
    15621564                                                trgMCF.machineUserData.strName.c_str()).raw(), 1);
    15631565            if (FAILED(rc)) throw rc;
     
    16391641            if (RT_FAILURE(vrc))
    16401642                mrc = p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1641                                       p->tr("Could not delete file '%s' (%Rrc)"), newFiles.at(i).c_str(), vrc);
     1643                                      tr("Could not delete file '%s' (%Rrc)"), newFiles.at(i).c_str(), vrc);
    16421644        }
    16431645        /* Delete all already created medias. (Reverse, cause there could be
  • trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp

    r85217 r90828  
    134134        size_t len = m_targetPath.length() + 2;
    135135        if (len >= RTPATH_MAX)
    136             return m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr("The destination path exceeds the maximum value."));
     136            return m_pMachine->setError(VBOX_E_IPRT_ERROR, tr("The destination path exceeds the maximum value."));
    137137
    138138        /** @todo r=bird: I need to add a Utf8Str method or iprt/cxx/path.h thingy
     
    164164    if (RT_FAILURE(vrc))
    165165        return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    166                                         m_pMachine->tr("Unable to determine free space at move destination ('%s'): %Rrc"),
     166                                        tr("Unable to determine free space at move destination ('%s'): %Rrc"),
    167167                                        strTargetFolder.c_str(), vrc);
    168168
     
    179179        RTDirClose(hDir);
    180180        return m_pMachine->setErrorVrc(vrc,
    181                                        m_pMachine->tr("Can't create a test file test.txt in the %s. Check the access rights of the destination folder."),
     181                                       tr("Can't create a test file test.txt in the %s. Check the access rights of the destination folder."),
    182182                                       strTargetFolder.c_str());
    183183    }
     
    395395                          name.c_str()));
    396396                    return m_pMachine->setErrorVrc(vrc,
    397                                                    m_pMachine->tr("Failed to get file size for '%s': %Rrc"),
     397                                                   tr("Failed to get file size for '%s': %Rrc"),
    398398                                                   name.c_str(), vrc);
    399399                }
     
    435435                          name.c_str()));
    436436                    return m_pMachine->setErrorVrc(vrc,
    437                                                    m_pMachine->tr("Failed to get file size for '%s': %Rrc"),
     437                                                   tr("Failed to get file size for '%s': %Rrc"),
    438438                                                   name.c_str(), vrc);
    439439                }
     
    457457                if (cbFree - neededFreeSpace <= _1M)
    458458                    return m_pMachine->setError(E_FAIL,
    459                                                 m_pMachine->tr("Insufficient disk space available (%RTfoff needed, %RTfoff free)"),
     459                                                tr("Insufficient disk space available (%RTfoff needed, %RTfoff free)"),
    460460                                                neededFreeSpace, cbFree);
    461461
     
    501501        LogRel(("but free space on destination is %RTfoff\n", cbFree));
    502502        return m_pMachine->setError(VBOX_E_IPRT_ERROR,
    503                                     m_pMachine->tr("Insufficient disk space available (%RTfoff needed, %RTfoff free)"),
     503                                    tr("Insufficient disk space available (%RTfoff needed, %RTfoff free)"),
    504504                                    neededFreeSpace, cbFree);
    505505    }
     
    517517        hrc = m_pProgress->init(m_pMachine->i_getVirtualBox(),
    518518                                static_cast<IMachine *>(m_pMachine) /* aInitiator */,
    519                                 Utf8Str(m_pMachine->tr("Moving Machine")),
     519                                Utf8Str(tr("Moving Machine")),
    520520                                true /* fCancellable */,
    521521                                uCount,
    522522                                uTotalWeight,
    523                                 Utf8Str(m_pMachine->tr("Initialize Moving")),
     523                                Utf8Str(tr("Initialize Moving")),
    524524                                1);
    525525        if (FAILED(hrc))
    526526            return m_pMachine->setError(hrc,
    527                                         m_pMachine->tr("Couldn't correctly setup the progress object for moving VM operation"));
     527                                        tr("Couldn't correctly setup the progress object for moving VM operation"));
    528528    }
    529529
     
    690690                if (RT_FAILURE(vrc))
    691691                    throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    692                                                 taskMoveVM->m_pMachine->tr("Could not create snapshots folder '%s' (%Rrc)"),
     692                                                tr("Could not create snapshots folder '%s' (%Rrc)"),
    693693                                                strTrgSnapshotFolder.c_str(), vrc);
    694694            }
     
    702702
    703703                /* Move to next sub-operation. */
    704                 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(machine->tr("Copy the save state file '%s' ..."),
     704                hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Copy the save state file '%s' ..."),
    705705                                                                        RTPathFilename(sft.strFile.c_str())).raw(),
    706706                                                                sft.uWeight);
     
    712712                if (RT_FAILURE(vrc))
    713713                    throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    714                                                 taskMoveVM->m_pMachine->tr("Could not copy state file '%s' to '%s' (%Rrc)"),
     714                                                tr("Could not copy state file '%s' to '%s' (%Rrc)"),
    715715                                                sft.strFile.c_str(),
    716716                                                strTrgSaveState.c_str(),
     
    732732
    733733                /* Move to next sub-operation. */
    734                 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(machine->tr("Copy the NVRAM file '%s' ..."),
     734                hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Copy the NVRAM file '%s' ..."),
    735735                                                                        RTPathFilename(sft.strFile.c_str())).raw(),
    736736                                                                sft.uWeight);
     
    742742                if (RT_FAILURE(vrc))
    743743                    throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    744                                                 taskMoveVM->m_pMachine->tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"),
     744                                                tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"),
    745745                                                sft.strFile.c_str(),
    746746                                                strTrgNVRAM.c_str(),
     
    786786            Log2(("Copy Machine settings file\n"));
    787787
    788             hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(machine->tr("Copy Machine settings file '%s' ..."),
     788            hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Copy Machine settings file '%s' ..."),
    789789                                                                    machineConfFile->machineUserData.strName.c_str()).raw(),
    790790                                                            1);
     
    800800                if (RT_FAILURE(vrc))
    801801                    throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    802                                                 taskMoveVM->m_pMachine->tr("Could not create a home machine folder '%s' (%Rrc)"),
     802                                                tr("Could not create a home machine folder '%s' (%Rrc)"),
    803803                                                strTargetSettingsFilePath.c_str(), vrc);
    804804
     
    825825            if (RT_FAILURE(vrc))
    826826                throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    827                                             taskMoveVM->m_pMachine->tr("Could not copy the setting file '%s' to '%s' (%Rrc)"),
     827                                            tr("Could not copy the setting file '%s' to '%s' (%Rrc)"),
    828828                                            strSettingsFilePath.c_str(),
    829829                                            strTargetSettingsFilePath.stripFilename().c_str(),
     
    862862                        if (RT_FAILURE(vrc))
    863863                            throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    864                                                         taskMoveVM->m_pMachine->tr("Could not create log folder '%s' (%Rrc)"),
     864                                                        tr("Could not create log folder '%s' (%Rrc)"),
    865865                                                        strTargetLogFolderPath.c_str(), vrc);
    866866
     
    880880
    881881                        /* Move to next sub-operation. */
    882                         hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(machine->tr("Copying the log file '%s' ..."),
     882                        hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Copying the log file '%s' ..."),
    883883                                                                                RTPathFilename(strFullSourceFilePath.c_str())).raw(),
    884884                                                                       1);
     
    890890                        if (RT_FAILURE(vrc))
    891891                            throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    892                                                         taskMoveVM->m_pMachine->tr("Could not copy the log file '%s' to '%s' (%Rrc)"),
     892                                                        tr("Could not copy the log file '%s' to '%s' (%Rrc)"),
    893893                                                        strFullSourceFilePath.c_str(),
    894894                                                        strFullTargetFilePath.stripFilename().c_str(),
     
    11631163
    11641164                strTargetImageName.append(RTPATH_DELIMITER).append(strLocation);
    1165                 rc = m_pProgress->SetNextOperation(BstrFmt(machine->tr("Moving medium '%ls' ..."),
     1165                rc = m_pProgress->SetNextOperation(BstrFmt(tr("Moving medium '%ls' ..."),
    11661166                                                           bstrSrcName.raw()).raw(),
    11671167                                                   mt.uWeight);
     
    11711171            {
    11721172                strTargetImageName = mt.strBaseName;//Should contain full path to the image
    1173                 rc = m_pProgress->SetNextOperation(BstrFmt(machine->tr("Moving medium '%ls' back..."),
     1173                rc = m_pProgress->SetNextOperation(BstrFmt(tr("Moving medium '%ls' back..."),
    11741174                                                           bstrSrcName.raw()).raw(),
    11751175                                                   mt.uWeight);
     
    13241324    else if (vrc == VERR_FILE_NOT_FOUND)
    13251325        hrc = m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1326                                        m_pMachine->tr("Folder '%s' doesn't exist (%Rrc)"),
     1326                                       tr("Folder '%s' doesn't exist (%Rrc)"),
    13271327                                       strRootFolder.c_str(), vrc);
    13281328    else
    13291329        hrc = m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1330                                        m_pMachine->tr("Could not open folder '%s' (%Rrc)"),
     1330                                       tr("Could not open folder '%s' (%Rrc)"),
    13311331                                       strRootFolder.c_str(), vrc);
    13321332
     
    13471347        if (RT_FAILURE(vrc))
    13481348            return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1349                                             m_pMachine->tr("Could not delete file '%s' (%Rrc)"),
     1349                                            tr("Could not delete file '%s' (%Rrc)"),
    13501350                                            listOfFiles.at(i).c_str(), vrc);
    13511351
     
    13831383                else
    13841384                    return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1385                                                     m_pMachine->tr("Could not get the size of file '%s': %Rrc"),
     1385                                                    tr("Could not get the size of file '%s': %Rrc"),
    13861386                                                    fullPath.c_str(),
    13871387                                                    vrc);
     
    15691569        if (RT_FAILURE(vrc))
    15701570            return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1571                                             m_pMachine->tr("Could not get file size of '%s': %Rrc"),
     1571                                            tr("Could not get file size of '%s': %Rrc"),
    15721572                                            sft.strFile.c_str(),
    15731573                                            vrc);
     
    16011601        if (RT_FAILURE(vrc))
    16021602            return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    1603                                             m_pMachine->tr("Could not get file size of '%s': %Rrc"),
     1603                                            tr("Could not get file size of '%s': %Rrc"),
    16041604                                            sft.strFile.c_str(),
    16051605                                            vrc);
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r87241 r90828  
    2828#include "LoggingNew.h"
    2929#include "AutostartDb.h"
     30#include "VirtualBoxTranslator.h"
    3031
    3132// generated header
     
    3435#include <iprt/dir.h>
    3536#include <iprt/ldr.h>
     37#include <iprt/locale.h>
    3638#include <iprt/path.h>
    3739#include <iprt/string.h>
     
    18741876    m->strProxyUrl       = data.strProxyUrl;
    18751877
     1878    m->strLanguageId     = data.strLanguageId;
     1879
    18761880    m->fVBoxUpdateEnabled               = data.fVBoxUpdateEnabled;
    18771881    m->uVBoxUpdateFrequency             = data.uVBoxUpdateFrequency;
     
    22712275}
    22722276
     2277HRESULT SystemProperties::getLanguageId(com::Utf8Str &aLanguageId)
     2278{
     2279#ifdef VBOX_WITH_MAIN_NLS
     2280    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     2281    aLanguageId = m->strLanguageId;
     2282    alock.release();
     2283
     2284    HRESULT hrc = S_OK;
     2285    if (aLanguageId.isEmpty())
     2286    {
     2287        char szLocale[256];
     2288        memset(szLocale, 0, sizeof(szLocale));
     2289        int vrc = RTLocaleQueryNormalizedBaseLocaleName(szLocale, sizeof(szLocale));
     2290        if (RT_SUCCESS(vrc))
     2291            aLanguageId = szLocale;
     2292        else
     2293            hrc = Global::vboxStatusCodeToCOM(vrc);
     2294    }
     2295    return hrc;
     2296#else
     2297    aLanguageId = "C";
     2298    return S_OK;
     2299#endif
     2300}
     2301
     2302HRESULT SystemProperties::setLanguageId(const com::Utf8Str &aLanguageId)
     2303{
     2304#ifdef VBOX_WITH_MAIN_NLS
     2305    VirtualBoxTranslator *pTranslator = VirtualBoxTranslator::instance();
     2306    if (!pTranslator)
     2307        return E_FAIL;
     2308
     2309    HRESULT hrc = S_OK;
     2310    int vrc = pTranslator->i_loadLanguage(aLanguageId.c_str());
     2311    if (RT_SUCCESS(vrc))
     2312    {
     2313        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     2314        m->strLanguageId = aLanguageId;
     2315        alock.release();
     2316
     2317        // VirtualBox::i_saveSettings() needs vbox write lock
     2318        AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
     2319        hrc = mParent->i_saveSettings();
     2320    }
     2321    else
     2322        hrc = Global::vboxStatusCodeToCOM(vrc);
     2323
     2324    pTranslator->release();
     2325
     2326    if (SUCCEEDED(hrc))
     2327        mParent->i_onLanguageChanged(aLanguageId);
     2328
     2329    return hrc;
     2330#else
     2331    NOREF(aLanguageId);
     2332    return E_NOTIMPL;
     2333#endif
     2334}
     2335
    22732336HRESULT SystemProperties::getVBoxUpdateFrequency(ULONG *aVBoxUpdateFrequency)
    22742337{
  • trunk/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp

    r82968 r90828  
    265265    END_COM_MAP()
    266266
    267     DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilter)
     267    DECLARE_COMMON_CLASS_METHODS(USBDeviceFilter)
    268268
    269269    // IUSBDeviceFilter properties
  • trunk/src/VBox/Main/src-server/USBProxyService.cpp

    r82968 r90828  
    949949    va_list va;
    950950    va_start(va, aText);
    951     HRESULT rc = VirtualBoxBase::setErrorInternal(aResultCode,
    952                                                   COM_IIDOF(IHost),
    953                                                   "USBProxyService",
    954                                                   Utf8Str(aText, va),
    955                                                   false /* aWarning*/,
    956                                                   true /* aLogIt*/);
     951    HRESULT rc = VirtualBoxBase::setErrorInternalV(aResultCode,
     952                                                   COM_IIDOF(IHost),
     953                                                   "USBProxyService",
     954                                                   aText, va,
     955                                                   false /* aWarning*/,
     956                                                   true /* aLogIt*/);
    957957    va_end(va);
    958958    return rc;
  • trunk/src/VBox/Main/src-server/UnattendedInstaller.cpp

    r86270 r90828  
    165165        if (RT_FAILURE(vrc))
    166166            return mpParent->setErrorBoth(E_FAIL, vrc,
    167                                           mpParent->tr("Failed to construct path to the unattended installer script templates (%Rrc)"),
     167                                          tr("Failed to construct path to the unattended installer script templates (%Rrc)"),
    168168                                          vrc);
    169169    }
     
    183183        if (RT_FAILURE(vrc))
    184184            return mpParent->setErrorBoth(E_FAIL, vrc,
    185                                           mpParent->tr("Failed to construct path to the unattended installer script templates (%Rrc)"),
     185                                          tr("Failed to construct path to the unattended installer script templates (%Rrc)"),
    186186                                          vrc);
    187187    }
     
    208208     */
    209209    if (mpParent->i_getIsoPath().isEmpty())
    210         return mpParent->setError(E_INVALIDARG, mpParent->tr("Cannot proceed with an empty installation ISO path"));
     210        return mpParent->setError(E_INVALIDARG, tr("Cannot proceed with an empty installation ISO path"));
    211211    if (mpParent->i_getUser().isEmpty())
    212         return mpParent->setError(E_INVALIDARG, mpParent->tr("Empty user name is not allowed"));
     212        return mpParent->setError(E_INVALIDARG, tr("Empty user name is not allowed"));
    213213    if (mpParent->i_getPassword().isEmpty())
    214         return mpParent->setError(E_INVALIDARG, mpParent->tr("Empty password is not allowed"));
     214        return mpParent->setError(E_INVALIDARG, tr("Empty password is not allowed"));
    215215
    216216    LogRelFunc(("UnattendedInstaller::savePassedData(): \n"));
     
    372372
    373373            if (RTErrInfoIsSet(&ErrInfo.Core))
    374                 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to open newly created floppy image '%s': %Rrc: %s"),
     374                hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to open newly created floppy image '%s': %Rrc: %s"),
    375375                                             pszFilename, vrc, ErrInfo.Core.pszMsg);
    376376            else
    377                 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to open newly created floppy image '%s': %Rrc"),
     377                hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to open newly created floppy image '%s': %Rrc"),
    378378                                             pszFilename, vrc);
    379379        }
    380380        else
    381             hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to format floppy image '%s': %Rrc"), pszFilename, vrc);
     381            hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to format floppy image '%s': %Rrc"), pszFilename, vrc);
    382382        RTVfsFileRelease(hVfsFile);
    383383        RTFileDelete(pszFilename);
    384384    }
    385385    else
    386         hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to create floppy image '%s': %Rrc"), pszFilename, vrc);
     386        hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to create floppy image '%s': %Rrc"), pszFilename, vrc);
    387387    return hrc;
    388388}
     
    425425            else
    426426                hrc = mpParent->setErrorBoth(E_FAIL, vrc,
    427                                              mpParent->tr("Error writing %zu bytes to '%s' in floppy image '%s': %Rrc"),
     427                                             tr("Error writing %zu bytes to '%s' in floppy image '%s': %Rrc"),
    428428                                             strScript.length(), pEditor->getDefaultFilename(),
    429429                                             getAuxiliaryFloppyFilePath().c_str());
     
    433433    else
    434434        hrc = mpParent->setErrorBoth(E_FAIL, vrc,
    435                                      mpParent->tr("Error creating '%s' in floppy image '%s': %Rrc"),
     435                                     tr("Error creating '%s' in floppy image '%s': %Rrc"),
    436436                                     pEditor->getDefaultFilename(), getAuxiliaryFloppyFilePath().c_str());
    437437    return hrc;
     
    505505    int vrc = RTVfsFileOpenNormal(pszIsoPath, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, &hOrgIsoFile);
    506506    if (RT_FAILURE(vrc))
    507         return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to open ISO image '%s' (%Rrc)"), pszIsoPath, vrc);
     507        return mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to open ISO image '%s' (%Rrc)"), pszIsoPath, vrc);
    508508
    509509    /* Pass the file to the ISO file system interpreter. */
     
    514514        return S_OK;
    515515    if (RTErrInfoIsSet(&ErrInfo.Core))
    516         return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("ISO reader fail to open '%s' (%Rrc): %s"),
     516        return mpParent->setErrorBoth(E_FAIL, vrc, tr("ISO reader fail to open '%s' (%Rrc): %s"),
    517517                                      pszIsoPath, vrc, ErrInfo.Core.pszMsg);
    518     return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("ISO reader fail to open '%s' (%Rrc)"), pszIsoPath, vrc);
     518    return mpParent->setErrorBoth(E_FAIL, vrc, tr("ISO reader fail to open '%s' (%Rrc)"), pszIsoPath, vrc);
    519519}
    520520
     
    524524    if (RT_SUCCESS(vrc))
    525525        return S_OK;
    526     return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("RTFsIsoMakerCreate failed (%Rrc)"), vrc);
     526    return mpParent->setErrorBoth(E_FAIL, vrc, tr("RTFsIsoMakerCreate failed (%Rrc)"), vrc);
    527527}
    528528
     
    583583            else
    584584                hrc = mpParent->setErrorBoth(E_FAIL, vrc,
    585                                              mpParent->tr("RTFsIsoMakerAddFileWithVfsFile failed on the script '%s' (%Rrc)"),
     585                                             tr("RTFsIsoMakerAddFileWithVfsFile failed on the script '%s' (%Rrc)"),
    586586                                             pszDstFilename, vrc);
    587587        }
    588588        else
    589589            hrc = mpParent->setErrorBoth(E_FAIL, vrc,
    590                                          mpParent->tr("RTVfsFileFromBuffer failed on the %zu byte script '%s' (%Rrc)"),
     590                                         tr("RTVfsFileFromBuffer failed on the %zu byte script '%s' (%Rrc)"),
    591591                                         cchScript, pszDstFilename, vrc);
    592592    }
     
    601601    int vrc = RTFsIsoMakerFinalize(hIsoMaker);
    602602    if (RT_FAILURE(vrc))
    603         return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("RTFsIsoMakerFinalize failed (%Rrc)"), vrc);
     603        return mpParent->setErrorBoth(E_FAIL, vrc, tr("RTFsIsoMakerFinalize failed (%Rrc)"), vrc);
    604604
    605605    /*
     
    616616    {
    617617        if (vrc == VERR_ALREADY_EXISTS)
    618             return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("The auxiliary ISO image file '%s' already exists"),
     618            return mpParent->setErrorBoth(E_FAIL, vrc, tr("The auxiliary ISO image file '%s' already exists"),
    619619                                          pszFilename);
    620         return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to open the auxiliary ISO image file '%s' for writing (%Rrc)"),
     620        return mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to open the auxiliary ISO image file '%s' for writing (%Rrc)"),
    621621                                      pszFilename, vrc);
    622622    }
     
    639639                hrc = S_OK;
    640640            else
    641                 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Error writing auxiliary ISO image '%s' (%Rrc)"),
     641                hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Error writing auxiliary ISO image '%s' (%Rrc)"),
    642642                                             pszFilename, vrc);
    643643        }
    644644        else
    645645            hrc = mpParent->setErrorBoth(E_FAIL, VERR_INTERNAL_ERROR_2,
    646                                          mpParent->tr("Internal Error: Failed to case VFS file to VFS I/O stream"));
     646                                         tr("Internal Error: Failed to case VFS file to VFS I/O stream"));
    647647        RTVfsIoStrmRelease(hVfsSrcIso);
    648648        RTVfsIoStrmRelease(hVfsDstIso);
    649649    }
    650650    else
    651         hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("RTFsIsoMakerCreateVfsOutputFile failed (%Rrc)"), vrc);
     651        hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("RTFsIsoMakerCreateVfsOutputFile failed (%Rrc)"), vrc);
    652652    RTVfsFileRelease(hVfsSrcFile);
    653653    RTVfsFileRelease(hVfsDstFile);
     
    757757    RTMemTmpFree(papszArgs);
    758758    if (RT_FAILURE(vrc))
    759         return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("RTGetOptArgvToString failed (%Rrc)"), vrc);
     759        return mpParent->setErrorBoth(E_FAIL, vrc, tr("RTGetOptArgvToString failed (%Rrc)"), vrc);
    760760
    761761    /*
     
    780780            hrc = S_OK;
    781781        else
    782             hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, mpParent->tr("Error writing '%s' (%Rrc)"), pszFilename, vrc);
     782            hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Error writing '%s' (%Rrc)"), pszFilename, vrc);
    783783    }
    784784    else
    785         hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, mpParent->tr("Failed to create '%s' (%Rrc)"), pszFilename, vrc);
     785        hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Failed to create '%s' (%Rrc)"), pszFilename, vrc);
    786786
    787787    RTStrFree(pszCmdLine);
     
    802802    }
    803803    else
    804         hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, mpParent->tr("Failed to open '%s' on the ISO '%s' (%Rrc)"),
     804        hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Failed to open '%s' on the ISO '%s' (%Rrc)"),
    805805                                     pszFilename, mpParent->i_getIsoPath().c_str(), vrc);
    806806    return hrc;
  • trunk/src/VBox/Main/src-server/UnattendedScript.cpp

    r86660 r90828  
    131131                    && strncmp(pszPlaceholder, s_szPrefixCond,   sizeof(s_szPrefixCond)   - 1) != 0 ) )
    132132            {
    133                 hrc = mpSetError->setError(E_FAIL, mpSetError->tr("Malformed template placeholder '%.*s'"),
     133                hrc = mpSetError->setError(E_FAIL, tr("Malformed template placeholder '%.*s'"),
    134134                                           cchPlaceholder, pszPlaceholder);
    135135                break;
     
    179179                {
    180180                    hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR,
    181                                                    mpSetError->tr("%s without @@VBOX_COND_XXX@@ at offset %zu (%#zx)"),
     181                                                   tr("%s without @@VBOX_COND_XXX@@ at offset %zu (%#zx)"),
    182182                                                   s_szPrefixCondEnd, offPlaceholder, offPlaceholder);
    183183                    break;
     
    205205                {
    206206                    hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR,
    207                                                    mpSetError->tr("Too deep conditional nesting at offset %zu (%#zx)"),
     207                                                   tr("Too deep conditional nesting at offset %zu (%#zx)"),
    208208                                                   offPlaceholder, offPlaceholder);
    209209                    break;
     
    220220                return S_OK;
    221221            if (cConds == 1)
    222                 hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, mpSetError->tr("Missing @@VBOX_COND_END@@"));
     222                hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, tr("Missing @@VBOX_COND_END@@"));
    223223            else
    224                 hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, mpSetError->tr("Missing %u @@VBOX_COND_END@@"), cConds);
     224                hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, tr("Missing %u @@VBOX_COND_END@@"), cConds);
    225225            break;
    226226        }
     
    392392        {
    393393            rValue.setNull();
    394             return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, mpSetError->tr("Unknown guest OS major version '%s'"),
     394            return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Unknown guest OS major version '%s'"),
    395395                                            partList.at(0).c_str());
    396396        }
     
    441441    {
    442442        rValue.setNull();
    443         return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, mpSetError->tr("Unknown template placeholder '%.*s'"),
     443        return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Unknown template placeholder '%.*s'"),
    444444                                        cchFullPlaceholder, pachPlaceholder);
    445445    }
     
    526526    }
    527527    else
    528         return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, mpSetError->tr("Unknown conditional placeholder '%.*s'"),
     528        return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Unknown conditional placeholder '%.*s'"),
    529529                                        cchPlaceholder, pachPlaceholder);
    530530    return S_OK;
     
    566566        }
    567567        else if (pelmRoot)
    568             hrc = mpSetError->setError(E_FAIL, mpSetError->tr("XML document root element is '%s' instead of 'profile'"),
     568            hrc = mpSetError->setError(E_FAIL, tr("XML document root element is '%s' instead of 'profile'"),
    569569                                       pelmRoot->getName());
    570570        else
    571             hrc = mpSetError->setError(E_FAIL, mpSetError->tr("Missing XML root element"));
     571            hrc = mpSetError->setError(E_FAIL, tr("Missing XML root element"));
    572572    }
    573573    return hrc;
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r90440 r90828  
    297297        , pAutostartDb(NULL)
    298298        , fSettingsCipherKeySet(false)
     299#ifdef VBOX_WITH_MAIN_NLS
     300        , pVBoxTranslator(NULL)
     301#endif
    299302#if defined(RT_OS_WINDOWS) && defined(VBOXSVC_WITH_CLIENT_WATCHER)
    300303        , fWatcherIsReliable(RTSystemGetNtVersion() >= RTSYSTEM_MAKE_NT_VERSION(6, 0, 0))
     
    405408    bool                                fSettingsCipherKeySet;
    406409    uint8_t                             SettingsCipherKey[RTSHA512_HASH_SIZE];
    407 
     410#ifdef VBOX_WITH_MAIN_NLS
     411    VirtualBoxTranslator               *pVBoxTranslator;
     412#endif
    408413#if defined(RT_OS_WINDOWS) && defined(VBOXSVC_WITH_CLIENT_WATCHER)
    409414    /** Critical section protecting WatchedProcesses. */
     
    596601        rc = m->pSystemProperties->i_loadSettings(m->pMainConfigFile->systemProperties);
    597602        if (FAILED(rc)) throw rc;
    598 
     603#ifdef VBOX_WITH_MAIN_NLS
     604        m->pVBoxTranslator = VirtualBoxTranslator::instance();
     605        /* Do not throw an exception on language errors.
     606         * Just do not use translation. */
     607        if (m->pVBoxTranslator)
     608        {
     609            com::Utf8Str strLocale;
     610            HRESULT hrc = m->pSystemProperties->getLanguageId(strLocale);
     611            if (SUCCEEDED(hrc))
     612            {
     613                int vrc = m->pVBoxTranslator->i_loadLanguage(strLocale.c_str());
     614                if (RT_FAILURE(vrc))
     615                {
     616                    hrc = Global::vboxStatusCodeToCOM(vrc);
     617                    LogRel(("Load language failed (%Rhrc).\n", hrc));
     618                }
     619            }
     620            else
     621            {
     622                LogRel(("Getting language settings failed (%Rhrc).\n", hrc));
     623                m->pVBoxTranslator->release();
     624                m->pVBoxTranslator = NULL;
     625            }
     626        }
     627        else
     628            LogRel(("Translator creation failed.\n"));
     629#endif
    599630        /* guest OS type objects, needed by machines */
    600631        for (size_t i = 0; i < Global::cOSTypes; ++i)
     
    10931124
    10941125    delete m->pAutostartDb;
    1095 
     1126#ifdef VBOX_WITH_MAIN_NLS
     1127    if (m->pVBoxTranslator)
     1128        m->pVBoxTranslator->release();
     1129#endif
    10961130    // clean up our instance data
    10971131    delete m;
     
    35163550}
    35173551
     3552void VirtualBox::i_onLanguageChanged(const Utf8Str &aLanguageId)
     3553{
     3554    ComPtr<IEvent> ptrEvent;
     3555    HRESULT hrc = ::CreateLanguageChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aLanguageId);
     3556    AssertComRCReturnVoid(hrc);
     3557    i_postEvent(new AsyncEvent(this, ptrEvent));
     3558}
    35183559
    35193560void VirtualBox::i_onProgressCreated(const Guid &aId, BOOL aCreated)
     
    52805321            if (RT_FAILURE(vrc))
    52815322                return i_setErrorStaticBoth(VBOX_E_IPRT_ERROR, vrc,
    5282                                             Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"),
    5283                                                        strDir.c_str(),
    5284                                                        vrc));
     5323                                            tr("Could not create the directory '%s' (%Rrc)"),
     5324                                            strDir.c_str(),
     5325                                            vrc);
    52855326        }
    52865327        else
    52875328            return i_setErrorStaticBoth(VBOX_E_IPRT_ERROR, VERR_FILE_NOT_FOUND,
    5288                                         Utf8StrFmt(tr("Directory '%s' does not exist"), strDir.c_str()));
     5329                                        tr("Directory '%s' does not exist"), strDir.c_str());
    52895330    }
    52905331
  • trunk/src/VBox/Main/xml/Settings.cpp

    r88345 r90828  
    22622262                        pelmGlobalChild->getAttributeValue("VBoxUpdateLastCheckDate",
    22632263                            systemProperties.strVBoxUpdateLastCheckDate);
     2264                        pelmGlobalChild->getAttributeValue("LanguageId", systemProperties.strLanguageId);
    22642265                    }
    22652266                    else if (pelmGlobalChild->nameEquals("ExtraData"))
     
    24802481    if (systemProperties.strVBoxUpdateLastCheckDate.length())
    24812482        pelmSysProps->setAttribute("VBoxUpdateLastCheckDate", systemProperties.strVBoxUpdateLastCheckDate);
     2483    if (systemProperties.strLanguageId.isNotEmpty())
     2484        pelmSysProps->setAttribute("LanguageId", systemProperties.strLanguageId);
    24822485
    24832486    buildUSBDeviceFilters(*pelmGlobal->createChild("USBDeviceFilters"),
Note: See TracChangeset for help on using the changeset viewer.

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