summaryrefslogtreecommitdiff
path: root/sw/source/ui/config
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 /sw/source/ui/config
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 'sw/source/ui/config')
-rw-r--r--sw/source/ui/config/config.hrc35
-rw-r--r--sw/source/ui/config/mailconfigpage.cxx1
-rw-r--r--sw/source/ui/config/optdlg.src167
-rw-r--r--sw/source/ui/config/optload.cxx30
-rw-r--r--sw/source/ui/config/optload.src40
-rw-r--r--sw/source/ui/config/optpage.cxx11
6 files changed, 31 insertions, 253 deletions
diff --git a/sw/source/ui/config/config.hrc b/sw/source/ui/config/config.hrc
deleted file mode 100644
index 2de8d4218158..000000000000
--- a/sw/source/ui/config/config.hrc
+++ /dev/null
@@ -1,35 +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 INCLUDED_SW_SOURCE_UI_CONFIG_HRC
-#define INCLUDED_SW_SOURCE_UI_CONFIG_HRC
-
-#include "rcid.hrc"
-
-// strings for configuration
-
-#define STR_ARR_METRIC (RC_CONFIG_BEGIN + 26)
-#define CONFIG_ACT_END STR_ARR_METRIC
-
-#if CONFIG_ACT_END > RC_CONFIG_END
-#error Resource-Id Ueberlauf in #file, #line
-#endif
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx
index a5d2c436776e..3652ca979edf 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -33,7 +33,6 @@
#include <com/sun/star/mail/MailServiceProvider.hpp>
#include <vcl/msgbox.hxx>
#include <globals.hrc>
-#include <config.hrc>
#include <dbui.hrc>
#include "bitmaps.hlst"
#include <helpid.h>
diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src
deleted file mode 100644
index 9f4173a9f8b6..000000000000
--- a/sw/source/ui/config/optdlg.src
+++ /dev/null
@@ -1,167 +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 .
- */
-/* StarView resource file */
-#include <sfx2/sfx.hrc>
-#include <svx/dialogs.hrc>
-#include "globals.hrc"
-#include "config.hrc"
-#include "helpid.h"
-
-String ST_SCRIPT_ASIAN
-{
- Text [ en-US ] = "Asian";
-};
-String ST_SCRIPT_CTL
-{
- Text [ en-US ] = "CTL";
-};
-String ST_SCRIPT_WESTERN
-{
- Text [ en-US ] = "Western";
-};
-
-String STR_PRINTOPTUI_PRODUCTNAME
-{
- Text [ en-US ] = "%PRODUCTNAME %s";
-};
-String STR_PRINTOPTUI_CONTENTS
-{
- Text [ en-US ] = "Contents";
-};
-String STR_PRINTOPTUI_PAGE_BACKGROUND
-{
- Text [ en-US ] = "Page ba~ckground";
-};
-String STR_PRINTOPTUI_PICTURES
-{
- Text [ en-US ] = "P~ictures and other graphic objects";
-};
-String STR_PRINTOPTUI_HIDDEN
-{
- Text [ en-US ] = "Hidden te~xt";
-};
-String STR_PRINTOPTUI_TEXT_PLACEHOLDERS
-{
- Text [ en-US ] = "~Text placeholders";
-};
-String STR_PRINTOPTUI_FORM_CONTROLS
-{
- Text [ en-US ] = "Form control~s";
-};
-String STR_PRINTOPTUI_COLOR
-{
- Text [ en-US ] = "Color";
-};
-String STR_PRINTOPTUI_PRINT_BLACK
-{
- Text [ en-US ] = "Print text in blac~k";
-};
-String STR_PRINTOPTUI_PAGES_TEXT
-{
- Text [ en-US ] = "Pages";
-};
-String STR_PRINTOPTUI_PRINT_BLANK
-{
- Text [ en-US ] = "Print ~automatically inserted blank pages";
-};
-String STR_PRINTOPTUI_ONLY_PAPER
-{
- Text [ en-US ] = "~Use only paper tray from printer preferences";
-};
-String STR_PRINTOPTUI_PRINT
-{
- Text [ en-US ] = "Print";
-};
-String STR_PRINTOPTUI_NONE
-{
- Text [ en-US ] = "None (document only)";
-};
-String STR_PRINTOPTUI_COMMENTS_ONLY
-{
- Text [ en-US ] = "Comments only";
-};
-String STR_PRINTOPTUI_PLACE_END
-{
- Text [ en-US ] = "Place at end of document";
-};
-String STR_PRINTOPTUI_PLACE_PAGE
-{
- Text [ en-US ] = "Place at end of page";
-};
-String STR_PRINTOPTUI_COMMENTS
-{
- Text [ en-US ] = "~Comments";
-};
-String STR_PRINTOPTUI_PAGE_SIDES
-{
- Text [ en-US ] = "Page sides";
-};
-String STR_PRINTOPTUI_ALL_PAGES
-{
- Text [ en-US ] = "All pages";
-};
-String STR_PRINTOPTUI_BACK_PAGES
-{
- Text [ en-US ] = "Back sides / left pages";
-};
-String STR_PRINTOPTUI_FONT_PAGES
-{
- Text [ en-US ] = "Front sides / right pages";
-};
-String STR_PRINTOPTUI_INCLUDE
-{
- Text [ en-US ] = "Include";
-};
-String STR_PRINTOPTUI_BROCHURE
-{
- Text [ en-US ] = "Broch~ure";
-};
-String STR_PRINTOPTUI_LEFT_SCRIPT
-{
- Text [ en-US ] = "Left-to-right script";
-};
-String STR_PRINTOPTUI_RIGHT_SCRIPT
-{
- Text [ en-US ] = "Right-to-left script";
-};
-String STR_PRINTOPTUI_RANGE_COPIES
-{
- Text [ en-US ] = "Range and copies";
-};
-String STR_PRINTOPTUI_ALLPAGES
-{
- Text [ en-US ] = "~All pages";
-};
-String STR_PRINTOPTUI_SOMEPAGES
-{
- Text [ en-US ] = "Pa~ges";
-};
-String STR_PRINTOPTUI_SELECTION
-{
- Text [ en-US ] = "~Selection";
-};
-String STR_PRINTOPTUI_PLACE_MARGINS
-{
- Text [ en-US ] = "Place in margins";
-};
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index a994ee54484d..e22191afa640 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -31,6 +31,8 @@
#include <view.hxx>
#include "globals.hrc"
+#include "strings.hrc"
+#include "optload.hrc"
#include "cmdid.h"
#include "optload.hxx"
@@ -43,6 +45,7 @@
#include <svtools/insdlg.hxx>
#include <svtools/treelistentry.hxx>
+#include <tools/resary.hxx>
#include <vcl/builderfactory.hxx>
#include <vcl/settings.hxx>
@@ -50,7 +53,6 @@
#include <unotools/configmgr.hxx>
#include <docsh.hxx>
#include <app.hrc>
-#include <config.hrc>
#include <SwStyleNameMapper.hxx>
#include <numrule.hxx>
#include <SwNodeNum.hxx>
@@ -62,6 +64,25 @@ using namespace ::com::sun::star;
#include <svl/eitem.hxx>
+sal_uInt32 SwFieldUnitTable::Count()
+{
+ return SAL_N_ELEMENTS(STR_ARR_METRIC);
+}
+
+OUString SwFieldUnitTable::GetString(sal_uInt32 nPos)
+{
+ if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
+ return SwResId(STR_ARR_METRIC[nPos].first);
+ return OUString();
+}
+
+FieldUnit SwFieldUnitTable::GetValue(sal_uInt32 nPos)
+{
+ if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
+ return STR_ARR_METRIC[nPos].second;
+ return FUNIT_NONE;
+}
+
SwLoadOptPage::SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet)
: SfxTabPage(pParent, "OptGeneralPage", "modules/swriter/ui/optgeneralpage.ui", &rSet)
, m_pWrtShell(nullptr)
@@ -82,11 +103,10 @@ SwLoadOptPage::SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet)
get(m_pShowStandardizedPageCount, "standardizedpageshow");
get(m_pStandardizedPageSizeNF, "standardpagesize");
- SvxStringArray aMetricArr(ResId(STR_ARR_METRIC, *pSwResMgr));
- for ( sal_uInt32 i = 0; i < aMetricArr.Count(); ++i )
+ for (sal_uInt32 i = 0; i < SwFieldUnitTable::Count(); ++i)
{
- const OUString sMetric = aMetricArr.GetStringByPos( i );
- FieldUnit eFUnit = (FieldUnit)aMetricArr.GetValue( i );
+ const OUString sMetric = SwFieldUnitTable::GetString(i);
+ FieldUnit eFUnit = SwFieldUnitTable::GetValue(i);
switch ( eFUnit )
{
diff --git a/sw/source/ui/config/optload.src b/sw/source/ui/config/optload.src
deleted file mode 100644
index 855acbb809bb..000000000000
--- a/sw/source/ui/config/optload.src
+++ /dev/null
@@ -1,40 +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 "config.hrc"
-
-StringArray STR_ARR_METRIC
-{
- ItemList [ en-US ] =
- {
- < "Millimeter" ; FUNIT_MM ; > ;
- < "Centimeter" ; FUNIT_CM ; > ;
- < "Meter" ; FUNIT_M ; > ;
- < "Kilometer" ; FUNIT_KM ; > ;
- < "Inch" ; FUNIT_INCH ; > ;
- < "Foot" ; FUNIT_FOOT ; > ;
- < "Miles" ; FUNIT_MILE ; > ;
- < "Pica" ; FUNIT_PICA ; > ;
- < "Point" ; FUNIT_POINT ; > ;
- < "Char" ; FUNIT_CHAR ; >;
- < "Line" ; FUNIT_LINE ; >;
- };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index d608139bfee6..bc51b37bd194 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -45,7 +45,7 @@
#include <crstate.hxx>
#include <viewopt.hxx>
#include <globals.hrc>
-#include <config.hrc>
+#include <strings.hrc>
#include <swwrtshitem.hxx>
#include <unomid.h>
@@ -73,6 +73,8 @@
#include <vcl/builderfactory.hxx>
#include <vcl/svapp.hxx>
+#include "optload.hxx"
+
using namespace ::com::sun::star;
namespace {
@@ -128,11 +130,10 @@ SwContentOptPage::SwContentOptPage( vcl::Window* pParent,
m_pVRulerRightCBox->Hide();
m_pVRulerCBox->SetClickHdl(LINK(this, SwContentOptPage, VertRulerHdl ));
- SvxStringArray aMetricArr(ResId(STR_ARR_METRIC, *pSwResMgr));
- for ( size_t i = 0; i < aMetricArr.Count(); ++i )
+ for (size_t i = 0; i < SwFieldUnitTable::Count(); ++i)
{
- const OUString sMetric = aMetricArr.GetStringByPos( i );
- FieldUnit eFUnit = (FieldUnit)aMetricArr.GetValue( i );
+ const OUString sMetric = SwFieldUnitTable::GetString(i);
+ FieldUnit eFUnit = SwFieldUnitTable::GetValue(i);
switch ( eFUnit )
{