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 /forms/source/resource | |
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 'forms/source/resource')
-rw-r--r-- | forms/source/resource/frm_resource.cxx | 47 | ||||
-rw-r--r-- | forms/source/resource/strings.src | 152 | ||||
-rw-r--r-- | forms/source/resource/xforms.src | 177 |
3 files changed, 5 insertions, 371 deletions
diff --git a/forms/source/resource/frm_resource.cxx b/forms/source/resource/frm_resource.cxx index 3ae6805694c3..4a3ff363abf6 100644 --- a/forms/source/resource/frm_resource.cxx +++ b/forms/source/resource/frm_resource.cxx @@ -18,58 +18,21 @@ */ #include "frm_resource.hxx" -#include <tools/simplerm.hxx> +#include <tools/resmgr.hxx> -// needed as long as we have no contexts for components #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <svl/solar.hrc> - - namespace frm { - - - //= ResourceManager - - SimpleResMgr* ResourceManager::m_pImpl = nullptr; - - - ResourceManager::EnsureDelete::~EnsureDelete() - { - delete ResourceManager::m_pImpl; - } - - - void ResourceManager::ensureImplExists() + namespace ResourceManager { - if (m_pImpl) - return; - - m_pImpl = SimpleResMgr::Create("frm", Application::GetSettings().GetUILanguageTag()); - - if (m_pImpl) + OUString loadString(const char* pResId) { - // no that we have a impl class make sure it's deleted on unloading the library - static ResourceManager::EnsureDelete s_aDeleteTheImplClas; + static std::locale loc = Translate::Create("frm", Application::GetSettings().GetUILanguageTag()); + return Translate::get(pResId, loc); } } - - - OUString ResourceManager::loadString(sal_uInt16 _nResId) - { - OUString sReturn; - - ensureImplExists(); - if (m_pImpl) - sReturn = m_pImpl->ReadString(_nResId); - - return sReturn; - } - - } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/resource/strings.src b/forms/source/resource/strings.src deleted file mode 100644 index 3a252c7d78ab..000000000000 --- a/forms/source/resource/strings.src +++ /dev/null @@ -1,152 +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 "frm_resource.hrc" - -String RID_BASELISTBOX_ERROR_FILLLIST -{ - Text [ en-US ] = "The contents of a combo box or list field could not be determined."; -}; - -String RID_STR_IMPORT_GRAPHIC -{ - Text [ en-US ] = "Insert Image" ; -}; - -String RID_STR_CONTROL_SUBSTITUTED_NAME -{ - Text [ en-US ] = "substituted"; -}; - -String RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN -{ - Text [ en-US ] = "An error occurred while this control was being loaded. It was therefore replaced with a placeholder."; -}; - -String RID_STR_READERROR -{ - Text [ en-US ] = "Error reading data from database" ; -}; - -String RID_STR_CONNECTERROR -{ - Text [ en-US ] = "Connection failed" ; -}; - -String RID_ERR_LOADING_FORM -{ - Text [ en-US ] = "The data content could not be loaded."; -}; - -String RID_ERR_REFRESHING_FORM -{ - Text [ en-US ] = "The data content could not be updated"; -}; - -String RID_STR_ERR_INSERTRECORD -{ - Text [ en-US ] = "Error inserting the new record"; -}; - -String RID_STR_ERR_UPDATERECORD -{ - Text [ en-US ] = "Error updating the current record"; -}; - -String RID_STR_ERR_DELETERECORD -{ - Text [ en-US ] = "Error deleting the current record"; -}; - -String RID_STR_ERR_DELETERECORDS -{ - Text [ en-US ] = "Error deleting the specified records"; -}; - -String RID_STR_NEED_NON_NULL_OBJECT -{ - Text [ en-US ] = "The object cannot be NULL."; -}; - -String RID_STR_OPEN_GRAPHICS -{ - Text [ en-US ] = "Insert Image from..."; -}; - -String RID_STR_CLEAR_GRAPHICS -{ - Text [ en-US ] = "Remove Image"; -}; - -String RID_STR_INVALIDSTREAM -{ - Text [ en-US ] = "The given stream is invalid."; -}; - -String RID_STR_SYNTAXERROR -{ - Text [ en-US ] = "Syntax error in query expression" ; -}; - -String RID_STR_INCOMPATIBLE_TYPES -{ - Text [ en-US ] = "The value types supported by the binding cannot be used for exchanging data with this control."; -}; - -String RID_STR_LABEL_RECORD -{ - Text [ en-US ] = "Record"; -}; - -String RID_STR_INVALID_VALIDATOR -{ - Text [ en-US ] = "The control is connected to an external value binding, which at the same time acts as validator. You need to revoke the value binding, before you can set a new validator."; -}; - -String RID_STR_LABEL_OF -{ - Text [ en-US ] = "of"; -}; - -String RID_STR_QUERY_SAVE_MODIFIED_ROW -{ - Text [ en-US ] = "The content of the current form has been modified.\nDo you want to save your changes?"; -}; -String RID_STR_COULD_NOT_SET_ORDER -{ - Text [ en-US ] = "Error setting the sort criteria"; -}; -String RID_STR_COULD_NOT_SET_FILTER -{ - Text [ en-US ] = "Error setting the filter criteria"; -}; -String RID_STR_FEATURE_REQUIRES_PARAMETERS -{ - Text [ en-US ] = "To execute this function, parameters are needed."; -}; -String RID_STR_FEATURE_NOT_EXECUTABLE -{ - Text [ en-US ] = "This function cannot be executed, but is only for status queries."; -}; -String RID_STR_FEATURE_UNKNOWN -{ - Text [ en-US ] = "Unknown function."; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/resource/xforms.src b/forms/source/resource/xforms.src deleted file mode 100644 index 8c47e872c49c..000000000000 --- a/forms/source/resource/xforms.src +++ /dev/null @@ -1,177 +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 "frm_resource.hrc" - -String RID_STR_XFORMS_NO_BINDING_EXPRESSION -{ - Text [ en-US ] = "Please enter a binding expression."; -}; - -String RID_STR_XFORMS_INVALID_BINDING_EXPRESSION -{ - Text [ en-US ] = "This is an invalid binding expression."; -}; - -String RID_STR_XFORMS_INVALID_VALUE -{ - Text [ en-US ] = "Value is invalid."; -}; - -String RID_STR_XFORMS_REQUIRED -{ - Text [ en-US ] = "A value is required."; -}; - -String RID_STR_XFORMS_INVALID_CONSTRAINT -{ - Text [ en-US ] = "The constraint '$1' not validated."; -}; - -String RID_STR_XFORMS_VALUE_IS_NOT_A -{ - Text [ en-US ] = "The value is not of the type '$2'."; -}; - -String RID_STR_XFORMS_VALUE_MAX_INCL -{ - Text [ en-US ] = "The value must be smaller than or equal to $2."; -}; - -String RID_STR_XFORMS_VALUE_MAX_EXCL -{ - Text [ en-US ] = "The value must be smaller than $2."; -}; - -String RID_STR_XFORMS_VALUE_MIN_INCL -{ - Text [ en-US ] = "The value must be greater than or equal to $2."; -}; - -String RID_STR_XFORMS_VALUE_MIN_EXCL -{ - Text [ en-US ] = "The value must be greater than $2."; -}; - -String RID_STR_XFORMS_VALUE_TOTAL_DIGITS -{ - Text [ en-US ] = "$2 digits allowed at most."; -}; - -String RID_STR_XFORMS_VALUE_FRACTION_DIGITS -{ - Text [ en-US ] = "$2 fraction digits allowed at most."; -}; - -String RID_STR_XFORMS_VALUE_LENGTH -{ - Text [ en-US ] = "The string must be $2 characters long."; -}; - -String RID_STR_XFORMS_VALUE_MIN_LENGTH -{ - Text [ en-US ] = "The string must be at least $2 characters long."; -}; - -String RID_STR_XFORMS_VALUE_MAX_LENGTH -{ - Text [ en-US ] = "The string can only be $2 characters long at most."; -}; - -String RID_STR_DATATYPE_STRING -{ - Text [ en-US ] = "String"; -}; - -String RID_STR_DATATYPE_URL -{ - Text [ en-US ] = "Hyperlink"; -}; - -String RID_STR_DATATYPE_BOOLEAN -{ - Text [ en-US ] = "True/False (Boolean)"; -}; - -String RID_STR_DATATYPE_DECIMAL -{ - Text [ en-US ] = "Decimal"; -}; - -String RID_STR_DATATYPE_FLOAT -{ - Text [ en-US ] = "Floating point"; -}; - -String RID_STR_DATATYPE_DOUBLE -{ - Text [ en-US ] = "Double"; -}; - -String RID_STR_DATATYPE_DATE -{ - Text [ en-US ] = "Date"; -}; - -String RID_STR_DATATYPE_TIME -{ - Text [ en-US ] = "Time"; -}; - -String RID_STR_DATATYPE_DATETIME -{ - Text [ en-US ] = "Date and Time"; -}; - -String RID_STR_DATATYPE_YEAR -{ - Text [ en-US ] = "Year"; -}; - -String RID_STR_DATATYPE_MONTH -{ - Text [ en-US ] = "Month"; -}; - -String RID_STR_DATATYPE_DAY -{ - Text [ en-US ] = "Day"; -}; - -String RID_STR_XFORMS_CANT_EVALUATE -{ - Text [ en-US ] = "Error during evaluation"; -}; - -String RID_STR_XFORMS_PATTERN_DOESNT_MATCH -{ - Text [ en-US ] = "The string '$1' does not match the required regular expression '$2'."; -}; - -String RID_STR_XFORMS_BINDING_UI_NAME -{ - Text [ en-US ] = "Binding" ; -}; - -String RID_STR_XFORMS_CANT_REMOVE_TYPE -{ - Text [ en-US ] = "This is a built-in type and cannot be removed." ; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |