summaryrefslogtreecommitdiff
path: root/vcl/source/control
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 /vcl/source/control
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 'vcl/source/control')
-rw-r--r--vcl/source/control/button.cxx60
-rw-r--r--vcl/source/control/edit.cxx10
-rw-r--r--vcl/source/control/field.cxx2
-rw-r--r--vcl/source/control/imgctrl.cxx1
-rw-r--r--vcl/source/control/spinbtn.cxx1
-rw-r--r--vcl/source/control/tabctrl.cxx2
6 files changed, 28 insertions, 48 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index aed5ef25a4ef..bf0432c2e143 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -37,7 +37,7 @@
#include <vcl/vclstatuslistener.hxx>
#include <vcl/uitest/uiobject.hxx>
-#include <svids.hrc>
+#include <strings.hrc>
#include <bitmaps.hlst>
#include <svdata.hxx>
#include <window.h>
@@ -122,46 +122,32 @@ void Button::Click()
ImplCallEventListenersAndHandler( VclEventId::ButtonClick, [this] () { maClickHdl.Call(this); } );
}
-OUString Button::GetStandardText( StandardButtonType eButton )
+OUString Button::GetStandardText(StandardButtonType eButton)
{
- static struct
+ static const char* aResIdAry[static_cast<int>(StandardButtonType::Count)] =
{
- sal_uInt32 nResId;
- const char* pDefText;
- } aResIdAry[static_cast<int>(StandardButtonType::Count)] =
- {
- { SV_BUTTONTEXT_OK, "~OK" },
- { SV_BUTTONTEXT_CANCEL, "~Cancel" },
- { SV_BUTTONTEXT_YES, "~Yes" },
- { SV_BUTTONTEXT_NO, "~No" },
- { SV_BUTTONTEXT_RETRY, "~Retry" },
- { SV_BUTTONTEXT_HELP, "~Help" },
- { SV_BUTTONTEXT_CLOSE, "~Close" },
- { SV_BUTTONTEXT_MORE, "~More" },
- { SV_BUTTONTEXT_IGNORE, "~Ignore" },
- { SV_BUTTONTEXT_ABORT, "~Abort" },
- { SV_BUTTONTEXT_LESS, "~Less" }
- };
-
- ResMgr* pResMgr = ImplGetResMgr();
-
- if (!pResMgr)
- {
- OString aT( aResIdAry[(sal_uInt16)eButton].pDefText );
- return OStringToOUString(aT, RTL_TEXTENCODING_ASCII_US);
- }
-
- sal_uInt32 nResId = aResIdAry[(sal_uInt16)eButton].nResId;
+ // http://lists.freedesktop.org/archives/libreoffice/2013-January/044513.html
+ // Under windows we don't want accelerators on ok/cancel but do on other
+ // buttons
#ifdef _WIN32
- // http://lists.freedesktop.org/archives/libreoffice/2013-January/044513.html
- // Under windows we don't want accelerators on ok/cancel but do on other
- // buttons
- if (nResId == SV_BUTTONTEXT_OK)
- nResId = SV_BUTTONTEXT_OK_NOMNEMONIC;
- else if (nResId == SV_BUTTONTEXT_CANCEL)
- nResId = SV_BUTTONTEXT_CANCEL_NOMNEMONIC;
+ SV_BUTTONTEXT_OK_NOMNEMONIC,
+ SV_BUTTONTEXT_CANCEL_NOMNEMONIC,
+#else
+ SV_BUTTONTEXT_OK,
+ SV_BUTTONTEXT_CANCEL,
#endif
- return ResId(nResId, *pResMgr);
+ SV_BUTTONTEXT_YES,
+ SV_BUTTONTEXT_NO,
+ SV_BUTTONTEXT_RETRY,
+ SV_BUTTONTEXT_HELP,
+ SV_BUTTONTEXT_CLOSE,
+ SV_BUTTONTEXT_MORE,
+ SV_BUTTONTEXT_IGNORE,
+ SV_BUTTONTEXT_ABORT,
+ SV_BUTTONTEXT_LESS,
+ };
+
+ return VclResId(aResIdAry[(sal_uInt16)eButton]);
}
bool Button::SetModeImage( const Image& rImage )
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index dd289eff827f..69cc50abf549 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -30,7 +30,7 @@
#include <window.h>
#include <svdata.hxx>
-#include <svids.hrc>
+#include <strings.hrc>
#include <controldata.hxx>
#include <com/sun/star/i18n/BreakIterator.hpp>
@@ -775,12 +775,8 @@ uno::Reference < i18n::XExtendedInputSequenceChecker > const & Edit::ImplGetInpu
void Edit::ShowTruncationWarning( vcl::Window* pParent )
{
- ResMgr* pResMgr = ImplGetResMgr();
- if( pResMgr )
- {
- ScopedVclPtrInstance< MessageDialog > aBox( pParent, ResId(SV_EDIT_WARNING_STR, *pResMgr), VclMessageType::Warning );
- aBox->Execute();
- }
+ ScopedVclPtrInstance< MessageDialog > aBox(pParent, VclResId(SV_EDIT_WARNING_STR), VclMessageType::Warning);
+ aBox->Execute();
}
bool Edit::ImplTruncateToMaxLen( OUString& rStr, sal_Int32 nSelectionLen ) const
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index c92d8b95c78d..1256472fb8de 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -29,7 +29,7 @@
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
-#include "svids.hrc"
+#include "strings.hrc"
#include "svdata.hxx"
#include "i18nutil/unicode.hxx"
diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx
index f3d1942eabd6..f1ff32a111ba 100644
--- a/vcl/source/control/imgctrl.cxx
+++ b/vcl/source/control/imgctrl.cxx
@@ -19,7 +19,6 @@
#include <vcl/event.hxx>
#include <vcl/imgctrl.hxx>
-#include <tools/rcid.h>
#include <com/sun/star/awt/ImageScaleMode.hpp>
diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx
index 1899000f7d90..251ba7498343 100644
--- a/vcl/source/control/spinbtn.cxx
+++ b/vcl/source/control/spinbtn.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <tools/rcid.h>
#include <vcl/event.hxx>
#include <vcl/spin.hxx>
#include <vcl/settings.hxx>
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index d35551011eaf..746c6c0acc4e 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -31,8 +31,8 @@
#include <vcl/settings.hxx>
#include <vcl/uitest/uiobject.hxx>
#include <vcl/builderfactory.hxx>
+#include <strings.hrc>
#include <bitmaps.hlst>
-#include <svids.hrc>
#include "controldata.hxx"
#include "svdata.hxx"