diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-06-11 20:56:30 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-21 08:20:50 +0100 |
commit | 00657aef09d854c74fb426a935a3e8b1fc390bb0 (patch) | |
tree | fd1a9bb264fe15dcc129498e62060ecd256b1ee7 /extensions/source/update | |
parent | fa987cbb813cfd729fe490f2f1258b7c8d7fb174 (diff) |
migrate to boost::gettext
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl
* all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string")
* ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching
MODULE .mo files
* UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui
goes from l10n target to normal one, so the res/lang.zips of UI files go away
* translation via Translation::get(hrc-define-key, imbued-std::locale)
* python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there
to keep finding the .hrc file uniform) so magic numbers can go away there
* java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation
mechanism
* en-US res files go away, their strings are now the .hrc keys in the source code
* remaining .res files are replaced by .mo files
* in .res/.ui-lang-zip files, the old scheme missing translations of strings
results in inserting the english original so something can be found, now the
standard fallback of using the english original from the source key is used, so
partial translations shrink dramatically in size
* extract .hrc strings with hrcex which backs onto
xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap
* extract .ui strings with uiex which backs onto
xgettext --add-comments --no-wrap
* qtz for gettext translations is generated at runtime as ascii-ified crc32 of
content + "|" + msgid
* [API CHANGE] remove deprecated binary .res resouce loader related uno apis
com::sun::star::resource::OfficeResourceLoader
com::sun::star::resource::XResourceBundleLoader
com::sun::star::resource::XResourceBundle
when translating strings via uno apis
com.sun.star.resource.StringResourceWithLocation
can continue to be used
Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
Diffstat (limited to 'extensions/source/update')
-rw-r--r-- | extensions/source/update/check/updatehdl.cxx | 141 | ||||
-rw-r--r-- | extensions/source/update/check/updatehdl.hrc | 76 | ||||
-rw-r--r-- | extensions/source/update/check/updatehdl.hxx | 5 | ||||
-rw-r--r-- | extensions/source/update/check/updatehdl.src | 257 | ||||
-rw-r--r-- | extensions/source/update/ui/updatecheckui.cxx | 13 |
5 files changed, 65 insertions, 427 deletions
diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index b5dea59112d0..503552261f63 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -59,11 +59,12 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/task/InteractionHandler.hpp" #include "com/sun/star/task/InteractionRequestStringResolver.hpp" -#include <com/sun/star/resource/MissingResourceException.hpp> -#include <com/sun/star/resource/XResourceBundleLoader.hpp> -#include "updatehdl.hrc" +#include "strings.hrc" +#include <tools/resmgr.hxx> #include <tools/urlobj.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> #define COMMAND_CLOSE "close" @@ -591,24 +592,10 @@ void UpdateHandler::updateState( UpdateState eState ) meLastState = eState; } - -OUString UpdateHandler::loadString( const uno::Reference< resource::XResourceBundle >& rBundle, - sal_Int32 nResourceId ) +OUString UpdateHandler::loadString(const std::locale& rLocale, + const char* pResourceId) { - OUString sString; - OUString sKey = "string:" + OUString::number( nResourceId ); - - try - { - OSL_VERIFY( rBundle->getByName( sKey ) >>= sString ); - } - catch( const uno::Exception& ) - { - OSL_FAIL( "UpdateHandler::loadString: caught an exception!" ); - sString = "Missing " + sKey; - } - - return sString; + return Translate::get(pResourceId, rLocale); } OUString UpdateHandler::substVariables( const OUString &rSource ) const @@ -620,7 +607,6 @@ OUString UpdateHandler::substVariables( const OUString &rSource ) const .replaceAll( "%PERCENT", OUString::number( mnPercent ) ); } - void UpdateHandler::loadStrings() { if ( mbStringsLoaded ) @@ -628,76 +614,65 @@ void UpdateHandler::loadStrings() else mbStringsLoaded = true; - uno::Reference< resource::XResourceBundleLoader > xLoader; - try - { - uno::Any aValue( mxContext->getValueByName( - "/singletons/com.sun.star.resource.OfficeResourceLoader" ) ); - OSL_VERIFY( aValue >>= xLoader ); - } - catch( const uno::Exception& ) - { - OSL_FAIL( "UpdateHandler::loadStrings: could not create the resource loader!" ); - } - - if ( !xLoader.is() ) return; - - uno::Reference< resource::XResourceBundle > xBundle; - - try - { - xBundle = xLoader->loadBundle_Default( "upd" ); - } - catch( const resource::MissingResourceException& ) - { - OSL_FAIL( "UpdateHandler::loadStrings: missing the resource bundle!" ); - } + std::locale loc = Translate::Create("pcr", Application::GetSettings().GetUILanguageTag()); - if ( !xBundle.is() ) return; + msChecking = loadString( loc, RID_UPDATE_STR_CHECKING ); + msCheckingError = loadString( loc, RID_UPDATE_STR_CHECKING_ERR ); + msNoUpdFound = loadString( loc, RID_UPDATE_STR_NO_UPD_FOUND ); - msChecking = loadString( xBundle, RID_UPDATE_STR_CHECKING ); - msCheckingError = loadString( xBundle, RID_UPDATE_STR_CHECKING_ERR ); - msNoUpdFound = loadString( xBundle, RID_UPDATE_STR_NO_UPD_FOUND ); - - msUpdFound = loadString( xBundle, RID_UPDATE_STR_UPD_FOUND ); + msUpdFound = loadString( loc, RID_UPDATE_STR_UPD_FOUND ); setFullVersion( msUpdFound ); - msDlgTitle = loadString( xBundle, RID_UPDATE_STR_DLG_TITLE ); - msDownloadPause = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_PAUSE ); - msDownloadError = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_ERR ); - msDownloadWarning = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_WARN ); - msDownloadDescr = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_DESCR ); - msDownloadNotAvail = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_UNAVAIL ); - msDownloading = loadString( xBundle, RID_UPDATE_STR_DOWNLOADING ); - msReady2Install = loadString( xBundle, RID_UPDATE_STR_READY_INSTALL ); - msCancelTitle = loadString( xBundle, RID_UPDATE_STR_CANCEL_TITLE ); - msCancelMessage = loadString( xBundle, RID_UPDATE_STR_CANCEL_DOWNLOAD ); - msInstallMessage = loadString( xBundle, RID_UPDATE_STR_BEGIN_INSTALL ); - msInstallNow = loadString( xBundle, RID_UPDATE_STR_INSTALL_NOW ); - msInstallLater = loadString( xBundle, RID_UPDATE_STR_INSTALL_LATER ); - msInstallError = loadString( xBundle, RID_UPDATE_STR_INSTALL_ERROR ); - msOverwriteWarning = loadString( xBundle, RID_UPDATE_STR_OVERWRITE_WARNING ); - msPercent = loadString( xBundle, RID_UPDATE_STR_PERCENT ); - msReloadWarning = loadString( xBundle, RID_UPDATE_STR_RELOAD_WARNING ); - msReloadReload = loadString( xBundle, RID_UPDATE_STR_RELOAD_RELOAD ); - msReloadContinue = loadString( xBundle, RID_UPDATE_STR_RELOAD_CONTINUE ); - - msStatusFL = loadString( xBundle, RID_UPDATE_FT_STATUS ); - msDescription = loadString( xBundle, RID_UPDATE_FT_DESCRIPTION ); - - msClose = loadString( xBundle, RID_UPDATE_BTN_CLOSE ); - msDownload = loadString( xBundle, RID_UPDATE_BTN_DOWNLOAD ); - msInstall = loadString( xBundle, RID_UPDATE_BTN_INSTALL ); - msPauseBtn = loadString( xBundle, RID_UPDATE_BTN_PAUSE ); - msResumeBtn = loadString( xBundle, RID_UPDATE_BTN_RESUME ); - msCancelBtn = loadString( xBundle, RID_UPDATE_BTN_CANCEL ); + msDlgTitle = loadString( loc, RID_UPDATE_STR_DLG_TITLE ); + msDownloadPause = loadString( loc, RID_UPDATE_STR_DOWNLOAD_PAUSE ); + msDownloadError = loadString( loc, RID_UPDATE_STR_DOWNLOAD_ERR ); + msDownloadWarning = loadString( loc, RID_UPDATE_STR_DOWNLOAD_WARN ); + msDownloadDescr = loadString( loc, RID_UPDATE_STR_DOWNLOAD_DESCR ); + msDownloadNotAvail = loadString( loc, RID_UPDATE_STR_DOWNLOAD_UNAVAIL ); + msDownloading = loadString( loc, RID_UPDATE_STR_DOWNLOADING ); + msReady2Install = loadString( loc, RID_UPDATE_STR_READY_INSTALL ); + msCancelTitle = loadString( loc, RID_UPDATE_STR_CANCEL_TITLE ); + msCancelMessage = loadString( loc, RID_UPDATE_STR_CANCEL_DOWNLOAD ); + msInstallMessage = loadString( loc, RID_UPDATE_STR_BEGIN_INSTALL ); + msInstallNow = loadString( loc, RID_UPDATE_STR_INSTALL_NOW ); + msInstallLater = loadString( loc, RID_UPDATE_STR_INSTALL_LATER ); + msInstallError = loadString( loc, RID_UPDATE_STR_INSTALL_ERROR ); + msOverwriteWarning = loadString( loc, RID_UPDATE_STR_OVERWRITE_WARNING ); + msPercent = loadString( loc, RID_UPDATE_STR_PERCENT ); + msReloadWarning = loadString( loc, RID_UPDATE_STR_RELOAD_WARNING ); + msReloadReload = loadString( loc, RID_UPDATE_STR_RELOAD_RELOAD ); + msReloadContinue = loadString( loc, RID_UPDATE_STR_RELOAD_CONTINUE ); + + msStatusFL = loadString( loc, RID_UPDATE_FT_STATUS ); + msDescription = loadString( loc, RID_UPDATE_FT_DESCRIPTION ); + + msClose = loadString( loc, RID_UPDATE_BTN_CLOSE ); + msDownload = loadString( loc, RID_UPDATE_BTN_DOWNLOAD ); + msInstall = loadString( loc, RID_UPDATE_BTN_INSTALL ); + msPauseBtn = loadString( loc, RID_UPDATE_BTN_PAUSE ); + msResumeBtn = loadString( loc, RID_UPDATE_BTN_RESUME ); + msCancelBtn = loadString( loc, RID_UPDATE_BTN_CANCEL ); + + std::pair<const char*, const char*> RID_UPDATE_BUBBLE[] = + { + { RID_UPDATE_BUBBLE_UPDATE_AVAIL, RID_UPDATE_BUBBLE_T_UPDATE_AVAIL }, + { RID_UPDATE_BUBBLE_UPDATE_NO_DOWN, RID_UPDATE_BUBBLE_T_UPDATE_NO_DOWN }, + { RID_UPDATE_BUBBLE_AUTO_START, RID_UPDATE_BUBBLE_T_AUTO_START }, + { RID_UPDATE_BUBBLE_DOWNLOADING, RID_UPDATE_BUBBLE_T_DOWNLOADING }, + { RID_UPDATE_BUBBLE_DOWNLOAD_PAUSED, RID_UPDATE_BUBBLE_T_DOWNLOAD_PAUSED }, + { RID_UPDATE_BUBBLE_ERROR_DOWNLOADING, RID_UPDATE_BUBBLE_T_ERROR_DOWNLOADING }, + { RID_UPDATE_BUBBLE_DOWNLOAD_AVAIL, RID_UPDATE_BUBBLE_T_DOWNLOAD_AVAIL }, + { RID_UPDATE_BUBBLE_EXT_UPD_AVAIL, RID_UPDATE_BUBBLE_T_EXT_UPD_AVAIL } + }; + + static_assert(SAL_N_ELEMENTS(RID_UPDATE_BUBBLE) == UPDATESTATES_COUNT - UPDATESTATE_UPDATE_AVAIL, "mismatch"); // all update states before UPDATESTATE_UPDATE_AVAIL don't have a bubble // so we can ignore them - for ( int i=0; i < (int)(UPDATESTATES_COUNT - UPDATESTATE_UPDATE_AVAIL); i++ ) + for (size_t i = 0; i < SAL_N_ELEMENTS(RID_UPDATE_BUBBLE); ++i) { - msBubbleTexts[ i ] = loadString( xBundle, RID_UPDATE_BUBBLE_TEXT_START + i ); - msBubbleTitles[ i ] = loadString( xBundle, RID_UPDATE_BUBBLE_T_TEXT_START + i ); + msBubbleTexts[i] = loadString(loc, RID_UPDATE_BUBBLE[i].first); + msBubbleTitles[i] = loadString(loc, RID_UPDATE_BUBBLE[i].second); } for ( int i=0; i < BUTTON_COUNT; i++ ) diff --git a/extensions/source/update/check/updatehdl.hrc b/extensions/source/update/check/updatehdl.hrc deleted file mode 100644 index e4860416f681..000000000000 --- a/extensions/source/update/check/updatehdl.hrc +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - #define RID_UPDATE_HDL_START 1200 - - #define RID_UPDATE_STR_CHECKING RID_UPDATE_HDL_START + 1 - #define RID_UPDATE_STR_NO_UPD_FOUND RID_UPDATE_HDL_START + 2 - #define RID_UPDATE_STR_UPD_FOUND RID_UPDATE_HDL_START + 3 - #define RID_UPDATE_STR_DLG_TITLE RID_UPDATE_HDL_START + 4 - #define RID_UPDATE_STR_DOWNLOAD_ERR RID_UPDATE_HDL_START + 5 - #define RID_UPDATE_STR_DOWNLOAD_WARN RID_UPDATE_HDL_START + 6 - #define RID_UPDATE_STR_DOWNLOADING RID_UPDATE_HDL_START + 7 - #define RID_UPDATE_STR_READY_INSTALL RID_UPDATE_HDL_START + 8 - #define RID_UPDATE_STR_CANCEL_TITLE RID_UPDATE_HDL_START + 9 - #define RID_UPDATE_STR_CANCEL_DOWNLOAD RID_UPDATE_HDL_START + 10 - #define RID_UPDATE_STR_BEGIN_INSTALL RID_UPDATE_HDL_START + 11 - #define RID_UPDATE_STR_INSTALL_NOW RID_UPDATE_HDL_START + 12 - #define RID_UPDATE_STR_INSTALL_LATER RID_UPDATE_HDL_START + 13 - #define RID_UPDATE_STR_CHECKING_ERR RID_UPDATE_HDL_START + 14 - #define RID_UPDATE_STR_OVERWRITE_WARNING RID_UPDATE_HDL_START + 15 - #define RID_UPDATE_STR_DOWNLOAD_PAUSE RID_UPDATE_HDL_START + 16 - #define RID_UPDATE_STR_DOWNLOAD_UNAVAIL RID_UPDATE_HDL_START + 17 - #define RID_UPDATE_STR_PERCENT RID_UPDATE_HDL_START + 18 - #define RID_UPDATE_STR_DOWNLOAD_DESCR RID_UPDATE_HDL_START + 19 - #define RID_UPDATE_STR_INSTALL_ERROR RID_UPDATE_HDL_START + 20 - #define RID_UPDATE_STR_RELOAD_WARNING RID_UPDATE_HDL_START + 21 - #define RID_UPDATE_STR_RELOAD_RELOAD RID_UPDATE_HDL_START + 22 - #define RID_UPDATE_STR_RELOAD_CONTINUE RID_UPDATE_HDL_START + 23 - - #define RID_UPDATE_FT_DESCRIPTION RID_UPDATE_HDL_START + 25 - #define RID_UPDATE_FT_STATUS RID_UPDATE_HDL_START + 26 - - #define RID_UPDATE_BTN_CLOSE RID_UPDATE_HDL_START + 30 - #define RID_UPDATE_BTN_DOWNLOAD RID_UPDATE_HDL_START + 31 - #define RID_UPDATE_BTN_INSTALL RID_UPDATE_HDL_START + 32 - #define RID_UPDATE_BTN_PAUSE RID_UPDATE_HDL_START + 33 - #define RID_UPDATE_BTN_RESUME RID_UPDATE_HDL_START + 34 - #define RID_UPDATE_BTN_CANCEL RID_UPDATE_HDL_START + 35 - - #define RID_UPDATE_BUBBLE_TEXT_START RID_UPDATE_HDL_START + 40 - #define RID_UPDATE_BUBBLE_UPDATE_AVAIL RID_UPDATE_BUBBLE_TEXT_START + 0 - #define RID_UPDATE_BUBBLE_UPDATE_NO_DOWN RID_UPDATE_BUBBLE_TEXT_START + 1 - #define RID_UPDATE_BUBBLE_AUTO_START RID_UPDATE_BUBBLE_TEXT_START + 2 - #define RID_UPDATE_BUBBLE_DOWNLOADING RID_UPDATE_BUBBLE_TEXT_START + 3 - #define RID_UPDATE_BUBBLE_DOWNLOAD_PAUSED RID_UPDATE_BUBBLE_TEXT_START + 4 - #define RID_UPDATE_BUBBLE_ERROR_DOWNLOADING RID_UPDATE_BUBBLE_TEXT_START + 5 - #define RID_UPDATE_BUBBLE_DOWNLOAD_AVAIL RID_UPDATE_BUBBLE_TEXT_START + 6 - #define RID_UPDATE_BUBBLE_EXT_UPD_AVAIL RID_UPDATE_BUBBLE_TEXT_START + 7 - - #define RID_UPDATE_BUBBLE_T_TEXT_START RID_UPDATE_HDL_START + 50 - #define RID_UPDATE_BUBBLE_T_UPDATE_AVAIL RID_UPDATE_BUBBLE_T_TEXT_START + 0 - #define RID_UPDATE_BUBBLE_T_UPDATE_NO_DOWN RID_UPDATE_BUBBLE_T_TEXT_START + 1 - #define RID_UPDATE_BUBBLE_T_AUTO_START RID_UPDATE_BUBBLE_T_TEXT_START + 2 - #define RID_UPDATE_BUBBLE_T_DOWNLOADING RID_UPDATE_BUBBLE_T_TEXT_START + 3 - #define RID_UPDATE_BUBBLE_T_DOWNLOAD_PAUSED RID_UPDATE_BUBBLE_T_TEXT_START + 4 - #define RID_UPDATE_BUBBLE_T_ERROR_DOWNLOADING RID_UPDATE_BUBBLE_T_TEXT_START + 5 - #define RID_UPDATE_BUBBLE_T_DOWNLOAD_AVAIL RID_UPDATE_BUBBLE_T_TEXT_START + 6 - #define RID_UPDATE_BUBBLE_T_EXT_UPD_AVAIL RID_UPDATE_BUBBLE_T_TEXT_START + 7 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx index 35258ffba73f..ee58d026e7d8 100644 --- a/extensions/source/update/check/updatehdl.hxx +++ b/extensions/source/update/check/updatehdl.hxx @@ -31,7 +31,6 @@ #include "com/sun/star/awt/XTopWindowListener.hpp" #include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/frame/XTerminateListener.hpp" -#include <com/sun/star/resource/XResourceBundle.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> #include <cppuhelper/implbase.hxx> @@ -141,8 +140,8 @@ private: void enableControls( short nCtrlState ); void setDownloadBtnLabel( bool bAppendDots ); void loadStrings(); - static OUString loadString( const css::uno::Reference< css::resource::XResourceBundle >& xBundle, - sal_Int32 nResourceId ); + static OUString loadString(const std::locale& rLocale, + const char* pResourceId); OUString substVariables( const OUString &rSource ) const; static void insertControlModel( css::uno::Reference< css::awt::XControlModel > const & rxDialogModel, OUString const & rServiceName, diff --git a/extensions/source/update/check/updatehdl.src b/extensions/source/update/check/updatehdl.src deleted file mode 100644 index 086f4bb7a3b2..000000000000 --- a/extensions/source/update/check/updatehdl.src +++ /dev/null @@ -1,257 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "updatehdl.hrc" - -String RID_UPDATE_STR_CHECKING -{ - Text [ en-US ] = "Checking..."; -}; - -String RID_UPDATE_STR_CHECKING_ERR -{ - Text [ en-US ] = "Checking for an update failed."; -}; - -String RID_UPDATE_STR_NO_UPD_FOUND -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION is up to date."; -}; - -String RID_UPDATE_STR_UPD_FOUND -{ - Text [ en-US ] = "%PRODUCTNAME %NEXTVERSION is available.\n\nThe installed version is %PRODUCTNAME %PRODUCTVERSION.\n\nNote: Before downloading an update, please ensure that you have sufficient access rights to install it.\nA password, usually the administrator's or root password, may be required."; -}; - -String RID_UPDATE_STR_DLG_TITLE -{ - Text [ en-US ] = "Check for Updates"; -}; - -String RID_UPDATE_STR_DOWNLOAD_PAUSE -{ - Text [ en-US ] = "Downloading %PRODUCTNAME %NEXTVERSION paused at..."; -}; - -String RID_UPDATE_STR_DOWNLOAD_ERR -{ - Text [ en-US ] = "Downloading %PRODUCTNAME %NEXTVERSION stalled at"; -}; - -String RID_UPDATE_STR_DOWNLOAD_WARN -{ - Text [ en-US ] = "The download location is: %DOWNLOAD_PATH.\n\nUnder Tools – Options... - %PRODUCTNAME – Online Update you can change the download location."; -}; - -String RID_UPDATE_STR_DOWNLOAD_DESCR -{ - Text [ en-US ] = "%FILE_NAME has been downloaded to %DOWNLOAD_PATH."; -}; - -String RID_UPDATE_STR_DOWNLOAD_UNAVAIL -{ - Text [ en-US ] = "The automatic download of the update is currently not available.\n\nClick 'Download...' to download %PRODUCTNAME %NEXTVERSION manually from the web site."; -}; - -String RID_UPDATE_STR_DOWNLOADING -{ - Text [ en-US ] = "Downloading %PRODUCTNAME %NEXTVERSION..."; -}; - -String RID_UPDATE_STR_READY_INSTALL -{ - Text [ en-US ] = "Download of %PRODUCTNAME %NEXTVERSION completed. Ready for installation."; -}; - -String RID_UPDATE_STR_CANCEL_TITLE -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION"; -}; - -String RID_UPDATE_STR_CANCEL_DOWNLOAD -{ - Text [ en-US ] = "Do you really want to cancel the download?"; -}; - -String RID_UPDATE_STR_BEGIN_INSTALL -{ - Text [ en-US ] = "To install the update, %PRODUCTNAME %PRODUCTVERSION needs to be closed. Do you want to install the update now?"; -}; - -String RID_UPDATE_STR_INSTALL_NOW -{ - Text [ en-US ] = "Install ~now"; -}; - -String RID_UPDATE_STR_INSTALL_LATER -{ - Text [ en-US ] = "Install ~later"; -}; - -String RID_UPDATE_STR_INSTALL_ERROR -{ - Text [ en-US ] = "Could not run the installer application, please run %FILE_NAME in %DOWNLOAD_PATH manually."; -}; - -String RID_UPDATE_STR_OVERWRITE_WARNING -{ - Text [ en-US ] = "A file with that name already exists! Do you want to overwrite the existing file?"; -}; - -String RID_UPDATE_STR_RELOAD_WARNING -{ - Text [ en-US ] = "A file with the name '%FILENAME' already exists in '%DOWNLOAD_PATH'! Do you want to continue with the download or delete and reload the file?"; -}; - -String RID_UPDATE_STR_RELOAD_RELOAD -{ - Text [ en-US ] = "Reload File"; -}; - -String RID_UPDATE_STR_RELOAD_CONTINUE -{ - Text [ en-US ] = "Continue"; -}; - -String RID_UPDATE_STR_PERCENT -{ - Text [ en-US ] = "%PERCENT%"; -}; - -String RID_UPDATE_FT_STATUS -{ - Text [ en-US ] = "Status"; -}; - -String RID_UPDATE_FT_DESCRIPTION -{ - Text [ en-US ] = "Description"; -}; - -String RID_UPDATE_BTN_CLOSE -{ - Text [ en-US ] = "Close"; -}; - -String RID_UPDATE_BTN_DOWNLOAD -{ - Text [ en-US ] = "~Download"; -}; - -String RID_UPDATE_BTN_INSTALL -{ - Text [ en-US ] = "~Install"; -}; - -String RID_UPDATE_BTN_PAUSE -{ - Text [ en-US ] = "~Pause"; -}; - -String RID_UPDATE_BTN_RESUME -{ - Text [ en-US ] = "~Resume"; -}; - -String RID_UPDATE_BTN_CANCEL -{ - Text [ en-US ] = "Cancel"; -}; - -String RID_UPDATE_BUBBLE_T_UPDATE_AVAIL -{ - Text [ en-US ] = "%PRODUCTNAME update available"; -}; - -String RID_UPDATE_BUBBLE_UPDATE_AVAIL -{ - Text [ en-US ] = "Click the icon to start the download."; -}; - -String RID_UPDATE_BUBBLE_T_UPDATE_NO_DOWN -{ - Text [ en-US ] = "%PRODUCTNAME update available"; -}; - -String RID_UPDATE_BUBBLE_UPDATE_NO_DOWN -{ - Text [ en-US ] = "Click the icon for more information."; -}; - -String RID_UPDATE_BUBBLE_T_AUTO_START -{ - Text [ en-US ] = "%PRODUCTNAME update available"; -}; - -String RID_UPDATE_BUBBLE_AUTO_START -{ - Text [ en-US ] = "Download of update begins."; -}; - -String RID_UPDATE_BUBBLE_T_DOWNLOADING -{ - Text [ en-US ] = "Download of update in progress"; -}; - -String RID_UPDATE_BUBBLE_DOWNLOADING -{ - Text [ en-US ] = ""; -}; - -String RID_UPDATE_BUBBLE_T_DOWNLOAD_PAUSED -{ - Text [ en-US ] = "Download of update paused"; -}; - -String RID_UPDATE_BUBBLE_DOWNLOAD_PAUSED -{ - Text [ en-US ] = "Click the icon to resume."; -}; - -String RID_UPDATE_BUBBLE_T_ERROR_DOWNLOADING -{ - Text [ en-US ] = "Download of update stalled"; -}; - -String RID_UPDATE_BUBBLE_ERROR_DOWNLOADING -{ - Text [ en-US ] = "Click the icon for more information."; -}; - -String RID_UPDATE_BUBBLE_T_DOWNLOAD_AVAIL -{ - Text [ en-US ] = "Download of update completed"; -}; - -String RID_UPDATE_BUBBLE_DOWNLOAD_AVAIL -{ - Text [ en-US ] = "Click the icon to start the installation."; -}; - -String RID_UPDATE_BUBBLE_T_EXT_UPD_AVAIL -{ - Text [ en-US ] = "Updates for extensions available"; -}; - -String RID_UPDATE_BUBBLE_EXT_UPD_AVAIL -{ - Text [ en-US ] = "Click the icon for more information."; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index 6eacc4a9e82d..4afdda908a1a 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -32,9 +32,8 @@ #include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/task/XJob.hpp> - #include <comphelper/processfactory.hxx> - +#include <tools/resmgr.hxx> #include <vcl/window.hxx> #include <vcl/floatwin.hxx> #include <vcl/timer.hxx> @@ -48,12 +47,11 @@ #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <sfx2/sfx.hrc> +#include <sfx2/strings.hrc> #include "rtl/ustrbuf.hxx" #include "bitmaps.hlst" -#define STR_NO_WEBBROWSER_FOUND (RID_SFX_APP_START + 7) - #define PROPERTY_TITLE "BubbleHeading" #define PROPERTY_TEXT "BubbleText" #define PROPERTY_IMAGE "BubbleImageURL" @@ -140,7 +138,7 @@ class UpdateCheckUI : public ::cppu::WeakImplHelper VclPtr<BubbleWindow> mpBubbleWin; VclPtr<SystemWindow> mpIconSysWin; VclPtr<MenuBar> mpIconMBar; - ResMgr* mpSfxResMgr; + std::locale maSfxLocale; Idle maWaitIdle; Timer maTimeoutTimer; Link<VclWindowEvent&,void> maWindowEventHdl; @@ -199,7 +197,7 @@ UpdateCheckUI::UpdateCheckUI(const uno::Reference<uno::XComponentContext>& xCont , mbBubbleChanged( false ) , mnIconID( 0 ) { - mpSfxResMgr = ResMgr::CreateResMgr( "sfx" ); + maSfxLocale = Translate::Create("sfx", Application::GetSettings().GetUILanguageTag()); maBubbleImage = GetBubbleImage( maBubbleImageURL ); @@ -221,7 +219,6 @@ UpdateCheckUI::~UpdateCheckUI() { Application::RemoveEventListener( maApplicationEventHdl ); RemoveBubbleWindow( true ); - delete mpSfxResMgr; } OUString SAL_CALL @@ -549,7 +546,7 @@ IMPL_LINK_NOARG(UpdateCheckUI, ClickHdl, MenuBar::MenuBarButtonCallbackArg&, boo mrJob->execute( aEmpty ); } catch(const uno::Exception&) { - ScopedVclPtrInstance<MessageDialog>(nullptr, ResId( STR_NO_WEBBROWSER_FOUND, *mpSfxResMgr))->Execute(); + ScopedVclPtrInstance<MessageDialog>(nullptr, Translate::get(STR_NO_WEBBROWSER_FOUND, maSfxLocale))->Execute(); } } |