From 00657aef09d854c74fb426a935a3e8b1fc390bb0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 11 Jun 2017 20:56:30 +0100 Subject: migrate to boost::gettext * all .ui files go from to 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 --- desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx | 26 +++++++++++++------------- desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 11 +++++------ desktop/source/pkgchk/unopkg/unopkg_shared.h | 9 +-------- 3 files changed, 19 insertions(+), 27 deletions(-) (limited to 'desktop/source/pkgchk') diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index d501c1954c64..9bb354d7db70 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -18,8 +18,8 @@ */ -#include "dp_gui.hrc" -#include "dp_gui_shared.hxx" +#include "strings.hrc" +#include "dp_shared.hxx" #include "unopkg_shared.h" #include #include @@ -40,7 +40,8 @@ #include #include -#include "deployment.hrc" +#include "strings.hrc" +#include "dp_shared.hxx" #include "dp_version.hxx" using namespace ::com::sun::star; @@ -134,16 +135,15 @@ CommandEnvironmentImpl::~CommandEnvironmentImpl() void CommandEnvironmentImpl::printLicense( const OUString & sName, const OUString& sLicense, bool & accept, bool &decline) { - ResMgr * pResMgr = DeploymentResMgr::get(); - OUString s1tmp(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr)); + OUString s1tmp(DpResId(RID_STR_UNOPKG_ACCEPT_LIC_1)); OUString s1(s1tmp.replaceAll("$NAME", sName)); - OUString s2 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_2, *pResMgr); - OUString s3 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_3, *pResMgr); - OUString s4 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_4, *pResMgr); - OUString sYES = ResId(RID_STR_UNOPKG_ACCEPT_LIC_YES, *pResMgr); - OUString sY = ResId(RID_STR_UNOPKG_ACCEPT_LIC_Y, *pResMgr); - OUString sNO = ResId(RID_STR_UNOPKG_ACCEPT_LIC_NO, *pResMgr); - OUString sN = ResId(RID_STR_UNOPKG_ACCEPT_LIC_N, *pResMgr); + OUString s2 = DpResId(RID_STR_UNOPKG_ACCEPT_LIC_2); + OUString s3 = DpResId(RID_STR_UNOPKG_ACCEPT_LIC_3); + OUString s4 = DpResId(RID_STR_UNOPKG_ACCEPT_LIC_4); + OUString sYES = DpResId(RID_STR_UNOPKG_ACCEPT_LIC_YES); + OUString sY = DpResId(RID_STR_UNOPKG_ACCEPT_LIC_Y); + OUString sNO = DpResId(RID_STR_UNOPKG_ACCEPT_LIC_NO); + OUString sN = DpResId(RID_STR_UNOPKG_ACCEPT_LIC_N); OUString sNewLine("\n"); @@ -262,7 +262,7 @@ void CommandEnvironmentImpl::handle( } else if (request >>= platExc) { - OUString sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *dp_gui::DeploymentGuiResMgr::get())); + OUString sMsg(DpResId(RID_STR_UNSUPPORTED_PLATFORM)); sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName()); dp_misc::writeConsole("\n" + sMsg + "\n\n"); approve = true; diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 8e692cdf2fc8..2e9fdda4dadb 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -38,10 +38,11 @@ #include #include -#include "deployment.hrc" +#include "strings.hrc" #include "unopkg_shared.h" #include "dp_identifier.hxx" -#include "dp_gui.hrc" +#include "dp_shared.hxx" +#include "strings.hrc" #include "lockfile.hxx" using namespace ::com::sun::star; @@ -441,10 +442,8 @@ Reference getUNO( { if (! s_lockfile.check( nullptr )) { - OUString sMsg(ResId(RID_STR_CONCURRENTINSTANCE, *DeploymentResMgr::get())); - //Create this string before we call DeInitVCL, because this will kill - //the ResMgr - OUString sError(ResId(RID_STR_UNOPKG_ERROR, *DeploymentResMgr::get())); + OUString sMsg(DpResId(RID_STR_CONCURRENTINSTANCE)); + OUString sError(DpResId(RID_STR_UNOPKG_ERROR)); sMsg += "\n" + getLockFilePath(); diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 1bd6a04b46bd..20ade0b5e4fd 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -31,14 +32,6 @@ namespace unopkg { -struct DeploymentResMgr : public rtl::StaticWithInit< ResMgr *, DeploymentResMgr > -{ - ResMgr * operator () () { - return ResMgr::CreateResMgr( - "deployment", LanguageTag( utl::ConfigManager::getLocale() ) ); - } -}; - struct OptionInfo { char const * m_name; -- cgit v1.2.3