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 /desktop/source/deployment/misc | |
parent | osl: Unix pipe converted from OSL_ASSERT to assert/SAL_WARNs (diff) | |
download | core-00657aef09d854c74fb426a935a3e8b1fc390bb0.tar.gz core-00657aef09d854c74fb426a935a3e8b1fc390bb0.zip |
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 'desktop/source/deployment/misc')
-rw-r--r-- | desktop/source/deployment/misc/dp_dependencies.cxx | 16 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_misc.src | 38 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_resource.cxx | 24 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_ucb.cxx | 2 |
4 files changed, 9 insertions, 71 deletions
diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx index 6112ad114593..1b858319f894 100644 --- a/desktop/source/deployment/misc/dp_dependencies.cxx +++ b/desktop/source/deployment/misc/dp_dependencies.cxx @@ -30,11 +30,11 @@ #include <rtl/ustring.h> #include <rtl/ustring.hxx> #include <sal/types.h> -#include <tools/resid.hxx> #include <unotools/configmgr.hxx> -#include "deployment.hrc" +#include "strings.hrc" #include "dp_resource.h" +#include "dp_shared.hxx" #include "dp_dependencies.hxx" #include "dp_descriptioninfoset.hxx" @@ -85,7 +85,7 @@ OUString produceErrorText( { return reason.replaceFirst("%VERSION", (version.isEmpty() - ? dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN) + ? DpResId(RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN) : version)); } @@ -156,27 +156,27 @@ OUString getErrorText( if ( dependency->getNamespaceURI() == namespaceOpenOfficeOrg && dependency->getTagName() == minimalVersionOpenOfficeOrg ) { return produceErrorText( - dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN), + DpResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN), dependency->getAttribute("value")); } else if (dependency->getNamespaceURI() == namespaceOpenOfficeOrg && dependency->getTagName() == maximalVersionOpenOfficeOrg ) { return produceErrorText( - dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX), + DpResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX), dependency->getAttribute("value")); } else if (dependency->getNamespaceURI() == namespaceLibreOffice && dependency->getTagName() == minimalVersionLibreOffice ) { return produceErrorText( - dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_LO_MIN), + DpResId(RID_DEPLOYMENT_DEPENDENCIES_LO_MIN), dependency->getAttribute("value")); } else if (dependency->hasAttributeNS(namespaceOpenOfficeOrg, minimalVersionOpenOfficeOrg)) { return produceErrorText( - dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN), + DpResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN), dependency->getAttributeNS(namespaceOpenOfficeOrg, minimalVersionOpenOfficeOrg)); } else { - return dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN); + return DpResId(RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN); } } diff --git a/desktop/source/deployment/misc/dp_misc.src b/desktop/source/deployment/misc/dp_misc.src deleted file mode 100644 index 498e042009dd..000000000000 --- a/desktop/source/deployment/misc/dp_misc.src +++ /dev/null @@ -1,38 +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 "deployment.hrc" - -String RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN { - Text[en-US] = "Unknown"; -}; - -String RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN { - Text[en-US] = "Extension requires at least OpenOffice.org reference version %VERSION"; -}; - -String RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX { - Text[en-US] = "Extension does not support OpenOffice.org reference versions greater than %VERSION"; -}; - -String RID_DEPLOYMENT_DEPENDENCIES_LO_MIN { - Text[en-US] = "Extension requires at least %PRODUCTNAME version %VERSION"; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/deployment/misc/dp_resource.cxx b/desktop/source/deployment/misc/dp_resource.cxx index b7f3739c85a2..2d37cd6685b5 100644 --- a/desktop/source/deployment/misc/dp_resource.cxx +++ b/desktop/source/deployment/misc/dp_resource.cxx @@ -46,32 +46,8 @@ struct OfficeLocale : } }; -struct DeploymentResMgr : public rtl::StaticWithInit< - ResMgr *, DeploymentResMgr> { - ResMgr * operator () () { - return ResMgr::CreateResMgr( "deployment", OfficeLocale::get() ); - } -}; - -class theResourceMutex : public rtl::Static<osl::Mutex, theResourceMutex> {}; - } // anon namespace - -ResId getResId( sal_uInt16 id ) -{ - const osl::MutexGuard guard( theResourceMutex::get() ); - return ResId( id, *DeploymentResMgr::get() ); -} - - -OUString getResourceString( sal_uInt16 id ) -{ - const osl::MutexGuard guard(theResourceMutex::get()); - OUString ret(ResId(id, *DeploymentResMgr::get())); - return ret.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName()); -} - const LanguageTag & getOfficeLanguageTag() { return OfficeLocale::get(); diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx index 2028d18c2192..d74bfc5e3f3d 100644 --- a/desktop/source/deployment/misc/dp_ucb.cxx +++ b/desktop/source/deployment/misc/dp_ucb.cxx @@ -18,7 +18,7 @@ */ -#include "deployment.hrc" +#include "strings.hrc" #include "dp_misc.h" #include "dp_ucb.h" #include <rtl/uri.hxx> |