summaryrefslogtreecommitdiff
path: root/offapi
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-11 20:56:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-07-21 08:20:50 +0100
commit00657aef09d854c74fb426a935a3e8b1fc390bb0 (patch)
treefd1a9bb264fe15dcc129498e62060ecd256b1ee7 /offapi
parentfa987cbb813cfd729fe490f2f1258b7c8d7fb174 (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 'offapi')
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/resource/MissingResourceException.idl2
-rw-r--r--offapi/com/sun/star/resource/OfficeResourceLoader.idl69
-rw-r--r--offapi/com/sun/star/resource/XLocale.idl2
-rw-r--r--offapi/com/sun/star/resource/XResourceBundle.idl226
-rw-r--r--offapi/com/sun/star/resource/XResourceBundleLoader.idl67
-rw-r--r--offapi/type_reference/offapi.idl12
7 files changed, 2 insertions, 379 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index ac292df2578e..f6f95a50f6fa 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -305,7 +305,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/report/inspection
DefaultComponentInspectorModel \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/resource,\
- OfficeResourceLoader \
StringResource \
StringResourceWithLocation \
StringResourceWithStorage \
@@ -3086,8 +3085,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/report/meta,\
$(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/resource,\
MissingResourceException \
XLocale \
- XResourceBundle \
- XResourceBundleLoader \
XStringResourceManager \
XStringResourcePersistence \
XStringResourceResolver \
diff --git a/offapi/com/sun/star/resource/MissingResourceException.idl b/offapi/com/sun/star/resource/MissingResourceException.idl
index 95e78e6a104a..9650d57ab61e 100644
--- a/offapi/com/sun/star/resource/MissingResourceException.idl
+++ b/offapi/com/sun/star/resource/MissingResourceException.idl
@@ -28,7 +28,7 @@ module com { module sun { module star { module resource {
/** is used to signal that a resource is missing.
- @see XResourceBundle
+ @see XStringResourceResolver
*/
published exception MissingResourceException: com::sun::star::uno::RuntimeException
{
diff --git a/offapi/com/sun/star/resource/OfficeResourceLoader.idl b/offapi/com/sun/star/resource/OfficeResourceLoader.idl
deleted file mode 100644
index 1caf113084f3..000000000000
--- a/offapi/com/sun/star/resource/OfficeResourceLoader.idl
+++ /dev/null
@@ -1,69 +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 .
- */
-
-#ifndef __com_sun_star_resource_OfficeResourceLoader_idl__
-#define __com_sun_star_resource_OfficeResourceLoader_idl__
-
-#include <com/sun/star/resource/XResourceBundleLoader.idl>
-
-module com { module sun { module star { module resource {
-
-/** describes a XResourceBundleLoader which provides access to the OpenOffice.org
- resource files.
-
- <p>An OpenOffice.org installation comes with a number of resource files in an proprietary
- format, located inside the installation's program/resource directory. The OfficeResourceLoader
- singleton (available at a component context as value with the key
- <code>/singletons/com.sun.star.resource.OfficeResourceLoader</code>), provides access to some
- types of resources within those files.</p>
-
- <p>Clients have to specify the resource file base name in the call to
- XResourceBundleLoader::loadBundle() resp. XResourceBundleLoader::loadBundle_Default()
- method. The loader will extent this base name so that the resulting name conforms to the OpenOffice.org
- resource file naming conventions, and look up the respective resource file, for the requested locale,
- in OpenOffice.org's installation.</p>
-
- <p>The lookup process uses the fallback mechanism as described at the XResourceBundle interface,
- except that <code>Locale.getDefault()</code> is not used.</p>
-
- <p>Resource keys, as passed to the XResourceBundle::getDirectElement() or
- com::sun::star::container::XNameAccess::getByName(), have the following format:
- <code>&lt;resource_type&gt;:&lt;numeric_identifier&gt;</code>, where <code>&lt;resource_type&gt;</code> specifies
- the type of the requested resource (see below) and <code>&lt;numeric_identifier&gt;</code> is the numeric
- identifier of the resource.</p>
-
- <p>The following resource types are currently supported:
- <ul>
- <li><em>string</em>: denotes a string resource</li>
- </ul>
- </p>
-
- <p>Since the numeric resource identifiers are highly build-dependent (e.g. can change with any next
- OpenOffice.org build), you are <strong>strongly</strong> discouraged from using the OfficeResourceLoader
- service in a component which targets more than one particular OpenOffice.org build.</p>
-
- @since OOo 2.0.3
-*/
-singleton OfficeResourceLoader : XResourceBundleLoader;
-
-}; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/resource/XLocale.idl b/offapi/com/sun/star/resource/XLocale.idl
index fe37fccfdb8d..562307d82def 100644
--- a/offapi/com/sun/star/resource/XLocale.idl
+++ b/offapi/com/sun/star/resource/XLocale.idl
@@ -30,7 +30,7 @@
module com { module sun { module star { module resource {
/** offers some operations on com::sun::star::lang::Locale
- structures.@see XResourceBundle
+ structures.
@see Locale
*/
published interface XLocale: com::sun::star::uno::XInterface
diff --git a/offapi/com/sun/star/resource/XResourceBundle.idl b/offapi/com/sun/star/resource/XResourceBundle.idl
deleted file mode 100644
index c0011ac33afe..000000000000
--- a/offapi/com/sun/star/resource/XResourceBundle.idl
+++ /dev/null
@@ -1,226 +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 .
- */
-#ifndef __com_sun_star_resource_XResourceBundle_idl__
-#define __com_sun_star_resource_XResourceBundle_idl__
-
-#include <com/sun/star/container/XNameAccess.idl>
-#include <com/sun/star/lang/Locale.idl>
-
-
-
-module com { module sun { module star { module resource {
-
-/** Resource bundles contain locale-specific objects.
-
- <p>When your program needs a locale-specific resource, such as
- <code>String</code> for example, your program can load it from the
- resource bundle that is appropriate for the current user's locale. In
- this way, you can write program code that is largely independent of
- the user's locale, which isolates most, if not all, of the
- locale-specific information in resource bundles.
-
- <p>This allows you to write programs that can:
-
- <UL type=SQUARE>
-
- <LI> be easily localized, or translated, into different
- languages.
-
- <LI> handle multiple locales at once.
-
- <LI> be easily modified, later, to support even more locales.
-
- </UL>
-
- <P> One resource bundle is, conceptually, a set of related services
- that supports <code>XResourceBundle</code>. Each related service of
- <code>XResourceBundle</code> has the same base name plus an
- additional component that identifies its locale. For example, suppose
- your resource bundle is named <code>MyResources</code>. The first
- service you are likely to implement is the default resource bundle,
- which has the same name as its family--<code>MyResources</code>. You
- can also provide as many related locale-specific services as you need.
-
- For example, perhaps you would provide a German one named
- <code>MyResources_de</code>.
-
- <P>
- Each related implementation of <code>XResourceBundle</code> contains
- the same items, but the items have been translated for the locale
- represented by that <code>XResourceBundle</code> implementation. For
- example, both <code>MyResources</code> and <code>MyResources_de</code>
- may have a <code>String</code> that is used on a button for
- confirming operations. In <code>MyResources</code> the
- <code>String</code> may contain <code>OK</code> and in
- <code>MyResources_de</code> it may contain <code>Gut</code>.
-
- <P>
- If there are different resources for different countries, you
- can make specializations: for example, <code>MyResources_de_CH</code>
- is the German language (de) in Switzerland (CH). If you only want to
- modify some of the resources in the specialization, you can do so.
-
- <P>
- When your program needs a locale-specific object, it loads
-
- the <code>XResourceBundle</code> implementation using the
- XResourceBundleLoader service:
-
- @code{.java}
- XResourceBundle myResources = xLoader.getBundle("MyResources", currentLocale);
- @endcode
-
- <p>The first argument specifies the family name of the resource
- bundle that contains the object in question. The second argument
- indicates the desired locale. <code>getBundle</code> uses these two
- arguments to construct the name of the <code>ResourceBundle</code>
- subclass it should load according to the following specifications.
-
- <P>The resource bundle lookup searches for services with various
- suffixes on the basis of (1) the desired locale and (2) the current
- default locale as returned by Locale.getDefault(), and (3) the root
- resource bundle (baseclass), in the following order from lower-level
- (more specific) to parent-level (less specific):
- <p> baseclass + "_" + language1 + "_" + country1 + "_" + variant1
- <BR> baseclass + "_" + language1 + "_" + country1
- <BR> baseclass + "_" + language1
- <BR> baseclass + "_" + language2 + "_" + country2 + "_" + variant2
- <BR> baseclass + "_" + language2 + "_" + country2
- <BR> baseclass + "_" + language2
- <BR> baseclass
-
- <P> For example, if the current default locale is <TT>en_US</TT>, the
- locale that the caller is interested in is <TT>fr_CH</TT>, and the
- resource bundle name is <TT>MyResources</TT>; resource bundle lookup
- will search for the following services, in order:
- <BR> <TT>MyResources_fr_CH
- <BR> MyResources_fr
- <BR> MyResources_en_US
- <BR> MyResources_en
- <BR> MyResources</TT>
-
- <P> The result of the lookup is a service, but that service may be
- backed by a property file on disk. If a lookup fails,
- <code>getBundle()</code> throws a
- <code>MissingResourceException</code>.
-
- <P> The base service <strong>must</strong> be fully qualified (for
- example, <code>myPackage::MyResources</code>, not just
- <code>MyResources</code>).
-
- <P> Resource bundles contain key/value pairs. The keys uniquely
- identify a locale-specific object in the bundle. Here is an
- example of a <code>XResourceBundle</code> implementation that contains
- two key/value pairs:
-
- @code{.java}
- class MyResource extends com.sun.star.resource.XResourceBundle
- {
- // some queryInterface stuff
-
- public final Object getDirectElement(String key)
- {
- if (key.equals("okKey")) return "Ok";
- if (key.equals("cancelKey")) return "Cancel";
- return null;
- }
- }
- @endcode
-
- <p>Keys are always <code>String</code>s. In this example, the keys
- are <code>OkKey</code> and <code>CancelKey</code>. In the above
- example, the values are also <code>String</code>s--<code>OK</code>
- and <code>Cancel</code>--but they do not have to be. The values can
- be any type of object.
-
- <P> You retrieve an object from resource bundle using the appropriate
- get method. Because <code>OkKey</code> and <code>CancelKey</code>
- are both strings, you use <code>getByName</code> to retrieve them:
-
- @code{.java}
- button1 = new Button(myResourceBundle.getByName("OkKey").getString());
- button2 = new Button(myResourceBundle.getByName("CancelKey").getString());
- @endcode
-
- <p>The get methods all require the key as an argument and return
- the object if found. If the object is not found, the get methods
- throw a com::sun::star::container::NoSuchElementException.
-
- <P> <STRONG>NOTE:</STRONG> You should always supply a base service
- with no suffixes. This will be the class of "last resort" if a
- locale is requested that does not exist. In fact, you must provide
- <I>all</I> of the services in any given inheritance chain for which
- you provide a resource. For example, if you provide
- <TT>MyResources_fr_BE</TT>, you must provide <I>both</I>
- <TT>MyResources</TT> <I>and</I> <TT>MyResources_fr</TT>, or the
- resource bundle lookup will not work right.
-
- <P>You do not have to restrict yourself to using a single family of
- <code>ResourceBundle</code>s. For example, you could have a set of
- bundles for exception messages, <code>ExceptionResources</code>
- (<code>ExceptionResources_fr</code>, <code>ExceptionResources_de</code>, ...),
- and one for widgets, <code>WidgetResource</code> (<code>WidgetResources_fr</code>,
- <code>WidgetResources_de</code>, ...); breaking up the resources however you like.
-
- @see MissingResourceException
- @see Locale
- @version 0.1 26 May 1999
- @author Mark Davis
- @author Markus Meyer
- @deprecated draft
-*/
-published interface XResourceBundle: com::sun::star::container::XNameAccess
-{
- /** contains the parent bundle of this bundle.
-
- <p>The parent bundle is searched by the method
- com::sun::star::container::XNameAccess::getByName()
- when this bundle does not contain a particular resource.
- */
- [attribute] XResourceBundle Parent;
-
- /** @returns
- the locale for this resource bundle.
-
- <p>This function can be used to determine whether the
- resource bundle that is returned really corresponds to the
- requested locale or is a fallback.
-
- */
- com::sun::star::lang::Locale getLocale();
-
- /** @returns
- an object from a resource bundle or NULL if no resource
- exists.
-
- <p>It does not look in the parents.
-
- @param key
- specifies the element.
- */
- any getDirectElement( [in] string key );
-
-};
-
-
-}; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/resource/XResourceBundleLoader.idl b/offapi/com/sun/star/resource/XResourceBundleLoader.idl
deleted file mode 100644
index fa25531647c1..000000000000
--- a/offapi/com/sun/star/resource/XResourceBundleLoader.idl
+++ /dev/null
@@ -1,67 +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 .
- */
-#ifndef __com_sun_star_resource_XResourceBundleLoader_idl__
-#define __com_sun_star_resource_XResourceBundleLoader_idl__
-
-#include <com/sun/star/uno/XInterface.idl>
-
-#include <com/sun/star/resource/XResourceBundle.idl>
-
-#include <com/sun/star/resource/MissingResourceException.idl>
-
-#include <com/sun/star/lang/Locale.idl>
-
-
-
-module com { module sun { module star { module resource {
-
-
-/** makes it possible to load resource bundles.
-
- <p>The search algorithm is specified in the documentation of
- XResourceBundle. The implementations must follow
- the name scheme, but it is allowed to search in several locations.
-
- @see MissingResourceException
- @see XResourceBundle
- @see Locale
- */
-published interface XResourceBundleLoader: com::sun::star::uno::XInterface
-{
-
- /** loads the appropriate resource bundle.
- */
- com::sun::star::resource::XResourceBundle loadBundle_Default( [in] string aBaseName )
- raises( com::sun::star::resource::MissingResourceException );
-
-
- /** loads the appropriate resource bundle subclass.
- */
- com::sun::star::resource::XResourceBundle loadBundle( [in] string abaseName,
- [in] com::sun::star::lang::Locale aLocale )
- raises( com::sun::star::resource::MissingResourceException );
-
-};
-
-
-}; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/type_reference/offapi.idl b/offapi/type_reference/offapi.idl
index e796d59192e2..e0c1235cb0cf 100644
--- a/offapi/type_reference/offapi.idl
+++ b/offapi/type_reference/offapi.idl
@@ -9805,12 +9805,6 @@ module com {
module resource {
published exception MissingResourceException: ::com::sun::star::uno::RuntimeException {
};
- published interface XResourceBundle;
- published interface XResourceBundleLoader {
- interface ::com::sun::star::uno::XInterface;
- ::com::sun::star::resource::XResourceBundle loadBundle_Default([in] string aBaseName) raises (::com::sun::star::resource::MissingResourceException);
- ::com::sun::star::resource::XResourceBundle loadBundle([in] string abaseName, [in] ::com::sun::star::lang::Locale aLocale) raises (::com::sun::star::resource::MissingResourceException);
- };
published interface XLocale {
interface ::com::sun::star::uno::XInterface;
::com::sun::star::lang::Locale create([in] string aLanguage, [in] string aCountry, [in] string aVariant);
@@ -9832,12 +9826,6 @@ module com {
string getDisplayName([in] ::com::sun::star::lang::Locale locale, [in] ::com::sun::star::lang::Locale inLocale);
boolean equals([in] ::com::sun::star::lang::Locale l1, [in] ::com::sun::star::lang::Locale l2);
};
- /** @deprecated */ published interface XResourceBundle {
- interface ::com::sun::star::container::XNameAccess;
- [attribute] ::com::sun::star::resource::XResourceBundle Parent;
- ::com::sun::star::lang::Locale getLocale();
- any getDirectElement([in] string key);
- };
};
module scanner {
published enum ScanError {