summaryrefslogtreecommitdiff
path: root/avmedia
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 /avmedia
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 'avmedia')
-rw-r--r--avmedia/AllLangMoTarget_avmedia.mk11
-rw-r--r--avmedia/AllLangResTarget_avmedia.mk30
-rw-r--r--avmedia/Module_avmedia.mk2
-rw-r--r--avmedia/inc/strings.hrc48
-rw-r--r--avmedia/source/framework/MediaControlBase.cxx2
-rw-r--r--avmedia/source/framework/mediacontrol.cxx2
-rw-r--r--avmedia/source/framework/mediacontrol.hrc37
-rw-r--r--avmedia/source/framework/mediacontrol.src98
-rw-r--r--avmedia/source/framework/mediamisc.cxx13
-rw-r--r--avmedia/source/framework/mediaplayer.cxx2
-rw-r--r--avmedia/source/inc/mediamisc.hxx22
-rw-r--r--avmedia/source/viewer/mediawindow.cxx2
-rw-r--r--avmedia/source/viewer/mediawindow.hrc26
-rw-r--r--avmedia/source/viewer/mediawindow.src47
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx2
15 files changed, 79 insertions, 265 deletions
diff --git a/avmedia/AllLangMoTarget_avmedia.mk b/avmedia/AllLangMoTarget_avmedia.mk
new file mode 100644
index 000000000000..564b9ab94b43
--- /dev/null
+++ b/avmedia/AllLangMoTarget_avmedia.mk
@@ -0,0 +1,11 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+
+$(eval $(call gb_AllLangMoTarget_AllLangMoTarget,avmedia))
+
+# vim: set noet sw=4 ts=4:
diff --git a/avmedia/AllLangResTarget_avmedia.mk b/avmedia/AllLangResTarget_avmedia.mk
deleted file mode 100644
index 3ffd6e0771c2..000000000000
--- a/avmedia/AllLangResTarget_avmedia.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_AllLangResTarget_AllLangResTarget,avmedia))
-
-$(eval $(call gb_AllLangResTarget_add_srs,avmedia,\
- avmedia/res \
-))
-
-$(eval $(call gb_SrsTarget_SrsTarget,avmedia/res))
-
-$(eval $(call gb_SrsTarget_set_include,avmedia/res,\
- $$(INCLUDE) \
- -I$(SRCDIR)/avmedia/inc \
- -I$(SRCDIR)/avmedia/source/framework \
- -I$(SRCDIR)/avmedia/source/viewer \
-))
-
-$(eval $(call gb_SrsTarget_add_files,avmedia/res,\
- avmedia/source/framework/mediacontrol.src \
- avmedia/source/viewer/mediawindow.src \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/avmedia/Module_avmedia.mk b/avmedia/Module_avmedia.mk
index d7625c86447c..deeae3979bef 100644
--- a/avmedia/Module_avmedia.mk
+++ b/avmedia/Module_avmedia.mk
@@ -14,7 +14,7 @@ $(eval $(call gb_Module_add_targets,avmedia,\
))
$(eval $(call gb_Module_add_l10n_targets,avmedia,\
- AllLangResTarget_avmedia \
+ AllLangMoTarget_avmedia \
))
ifeq ($(ENABLE_GSTREAMER_1_0),TRUE)
diff --git a/avmedia/inc/strings.hrc b/avmedia/inc/strings.hrc
new file mode 100644
index 000000000000..b4e260ad4363
--- /dev/null
+++ b/avmedia/inc/strings.hrc
@@ -0,0 +1,48 @@
+/* -*- 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_AVMEDIA_INC_STRINGS_HRC
+#define INCLUDED_AVMEDIA_INC_STRINGS_HRC
+
+#define NC_(Context, String) (Context "\004" u8##String)
+
+#define AVMEDIA_STR_OPEN NC_("AVMEDIA_STR_OPEN", "Open")
+#define AVMEDIA_STR_INSERT NC_("AVMEDIA_STR_INSERT", "Apply")
+#define AVMEDIA_STR_PLAY NC_("AVMEDIA_STR_PLAY", "Play")
+#define AVMEDIA_STR_PAUSE NC_("AVMEDIA_STR_PAUSE", "Pause")
+#define AVMEDIA_STR_STOP NC_("AVMEDIA_STR_STOP", "Stop")
+#define AVMEDIA_STR_LOOP NC_("AVMEDIA_STR_LOOP", "Repeat")
+#define AVMEDIA_STR_MUTE NC_("AVMEDIA_STR_MUTE", "Mute")
+#define AVMEDIA_STR_ZOOM NC_("AVMEDIA_STR_ZOOM", "View")
+#define AVMEDIA_STR_ZOOM_50 NC_("AVMEDIA_STR_ZOOM_50", "50%")
+#define AVMEDIA_STR_ZOOM_100 NC_("AVMEDIA_STR_ZOOM_100", "100%")
+#define AVMEDIA_STR_ZOOM_200 NC_("AVMEDIA_STR_ZOOM_200", "200%")
+#define AVMEDIA_STR_ZOOM_FIT NC_("AVMEDIA_STR_ZOOM_FIT", "Scaled")
+#define AVMEDIA_STR_MEDIAPLAYER NC_("AVMEDIA_STR_MEDIAPLAYER", "Media Player")
+#define AVMEDIA_MEDIA_PATH NC_("AVMEDIA_MEDIA_PATH", "Media Path")
+#define AVMEDIA_MEDIA_PATH_DEFAULT NC_("AVMEDIA_MEDIA_PATH_DEFAULT", "No Media Selected")
+#define AVMEDIA_STR_INSERTMEDIA_DLG NC_("AVMEDIA_STR_INSERTMEDIA_DLG", "Insert Audio or Video")
+#define AVMEDIA_STR_OPENMEDIA_DLG NC_("AVMEDIA_STR_OPENMEDIA_DLG", "Open Audio or Video")
+#define AVMEDIA_STR_ALL_MEDIAFILES NC_("AVMEDIA_STR_ALL_MEDIAFILES", "All audio and video files")
+#define AVMEDIA_STR_ALL_FILES NC_("AVMEDIA_STR_ALL_FILES", "All files")
+#define AVMEDIA_STR_ERR_URL NC_("AVMEDIA_STR_ERR_URL", "The format of the selected file is not supported.")
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+#endif
diff --git a/avmedia/source/framework/MediaControlBase.cxx b/avmedia/source/framework/MediaControlBase.cxx
index 390f08ff6dbc..ba848c050915 100644
--- a/avmedia/source/framework/MediaControlBase.cxx
+++ b/avmedia/source/framework/MediaControlBase.cxx
@@ -27,7 +27,7 @@
#include <tools/time.hxx>
#include <vcl/lstbox.hxx>
#include "bitmaps.hlst"
-#include "mediacontrol.hrc"
+#include "strings.hrc"
#include "helpids.hrc"
#include "mediamisc.hxx"
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index 6c1f77ba7d43..c5695c4f185a 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -18,7 +18,7 @@
*/
#include "mediacontrol.hxx"
-#include "mediacontrol.hrc"
+#include "strings.hrc"
#include "mediamisc.hxx"
#include <avmedia/mediawindow.hxx>
#include <avmedia/mediaplayer.hxx>
diff --git a/avmedia/source/framework/mediacontrol.hrc b/avmedia/source/framework/mediacontrol.hrc
deleted file mode 100644
index 3086496eb214..000000000000
--- a/avmedia/source/framework/mediacontrol.hrc
+++ /dev/null
@@ -1,37 +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 .
- */
-
-#define AVMEDIA_STR_PLAY 1024
-#define AVMEDIA_STR_PAUSE 1025
-#define AVMEDIA_STR_STOP 1026
-#define AVMEDIA_STR_LOOP 1027
-#define AVMEDIA_STR_ZOOM 1028
-#define AVMEDIA_STR_ZOOM_50 1029
-#define AVMEDIA_STR_ZOOM_100 1030
-#define AVMEDIA_STR_ZOOM_200 1031
-#define AVMEDIA_STR_ZOOM_FIT 1032
-#define AVMEDIA_STR_MUTE 1033
-#define AVMEDIA_STR_OPEN 1034
-#define AVMEDIA_STR_INSERT 1035
-#define AVMEDIA_STR_MEDIAPLAYER 1036
-
-#define AVMEDIA_MEDIA_PATH 4076
-#define AVMEDIA_MEDIA_PATH_DEFAULT 4078
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/framework/mediacontrol.src b/avmedia/source/framework/mediacontrol.src
deleted file mode 100644
index e62c43a27b4c..000000000000
--- a/avmedia/source/framework/mediacontrol.src
+++ /dev/null
@@ -1,98 +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 "mediacontrol.hrc"
-
-String AVMEDIA_STR_OPEN
-{
- Text[en-US] = "Open";
-};
-
-String AVMEDIA_STR_INSERT
-{
- Text [ en-US ] = "Apply" ;
-};
-
-String AVMEDIA_STR_PLAY
-{
- Text[en-US] = "Play";
-};
-
-String AVMEDIA_STR_PAUSE
-{
- Text[en-US] = "Pause";
-};
-
-String AVMEDIA_STR_STOP
-{
- Text[en-US] = "Stop";
-};
-
-String AVMEDIA_STR_LOOP
-{
- Text[en-US] = "Repeat";
-};
-
-String AVMEDIA_STR_MUTE
-{
- Text[en-US] = "Mute";
-};
-
-String AVMEDIA_STR_ZOOM
-{
- Text[en-US] = "View";
-};
-
-String AVMEDIA_STR_ZOOM_50
-{
- Text[en-US] = "50%";
-};
-
-String AVMEDIA_STR_ZOOM_100
-{
- Text[en-US] = "100%";
-};
-
-String AVMEDIA_STR_ZOOM_200
-{
- Text[en-US] = "200%";
-};
-
-String AVMEDIA_STR_ZOOM_FIT
-{
- Text[en-US] = "Scaled";
-};
-
-String AVMEDIA_STR_MEDIAPLAYER
-{
- Text[en-US] = "Media Player";
-};
-
-String AVMEDIA_MEDIA_PATH
-{
- Text[en-US] = "Media Path";
-};
-
-String AVMEDIA_MEDIA_PATH_DEFAULT
-{
- Text[en-US] = "No Media Selected";
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/framework/mediamisc.cxx b/avmedia/source/framework/mediamisc.cxx
index af9ce1b48b4e..50dd7687a0c0 100644
--- a/avmedia/source/framework/mediamisc.cxx
+++ b/avmedia/source/framework/mediamisc.cxx
@@ -18,7 +18,6 @@
*/
#include <tools/resmgr.hxx>
-#include <svl/solar.hrc>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -26,16 +25,10 @@
namespace avmedia {
-ResMgr* GetResMgr()
+const std::locale& GetResLocale()
{
- static ResMgr* pResMgr = nullptr;
-
- if( !pResMgr )
- {
- pResMgr = ResMgr::CreateResMgr("avmedia", Application::GetSettings().GetUILanguageTag());
- }
-
- return pResMgr;
+ static std::locale loc = Translate::Create("avmedia", Application::GetSettings().GetUILanguageTag());
+ return loc;
}
} // namespace avmedia
diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx
index a2e18fe50116..6cce70f2e026 100644
--- a/avmedia/source/framework/mediaplayer.cxx
+++ b/avmedia/source/framework/mediaplayer.cxx
@@ -21,7 +21,7 @@
#include <avmedia/mediawindow.hxx>
#include <avmedia/mediaitem.hxx>
#include "mediamisc.hxx"
-#include "mediacontrol.hrc"
+#include "strings.hrc"
#include "helpids.hrc"
#include <svl/stritem.hxx>
diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx
index aefc6ac49c0b..0a75833d3f92 100644
--- a/avmedia/source/inc/mediamisc.hxx
+++ b/avmedia/source/inc/mediamisc.hxx
@@ -21,17 +21,7 @@
#define INCLUDED_AVMEDIA_SOURCE_INC_MEDIAMISC_HXX
#include <config_features.h>
-#include <tools/resid.hxx>
-
-namespace avmedia
-{
- ResMgr* GetResMgr();
-}
-
-inline OUString AvmResId(sal_uInt16 nId)
-{
- return ResId(nId, * ::avmedia::GetResMgr());
-}
+#include <tools/resmgr.hxx>
#define AVMEDIA_MANAGER_SERVICE_PREFERRED "com.sun.star.comp.avmedia.Manager_VLC"
#ifdef _WIN32
@@ -55,6 +45,16 @@ inline OUString AvmResId(sal_uInt16 nId)
#define AVMEDIA_MIMETYPE_JSON "model/vnd.gltf+json"
#endif
+namespace avmedia
+{
+ const std::locale& GetResLocale();
+}
+
+inline OUString AvmResId(const char* pId)
+{
+ return Translate::get(pId, ::avmedia::GetResLocale());
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index 8145cea56b32..62fd5ee9349e 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -21,7 +21,7 @@
#include "mediawindow_impl.hxx"
#include "mediamisc.hxx"
#include "bitmaps.hlst"
-#include "mediawindow.hrc"
+#include "strings.hrc"
#include <tools/urlobj.hxx>
#include <vcl/layout.hxx>
#include <unotools/pathoptions.hxx>
diff --git a/avmedia/source/viewer/mediawindow.hrc b/avmedia/source/viewer/mediawindow.hrc
deleted file mode 100644
index b4ec26c6e357..000000000000
--- a/avmedia/source/viewer/mediawindow.hrc
+++ /dev/null
@@ -1,26 +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 .
- */
-
-#define AVMEDIA_STR_OPENMEDIA_DLG 16384
-#define AVMEDIA_STR_INSERTMEDIA_DLG 16385
-#define AVMEDIA_STR_ALL_MEDIAFILES 16386
-#define AVMEDIA_STR_ALL_FILES 16387
-#define AVMEDIA_STR_ERR_URL 16388
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/viewer/mediawindow.src b/avmedia/source/viewer/mediawindow.src
deleted file mode 100644
index 9c753a6f5b57..000000000000
--- a/avmedia/source/viewer/mediawindow.src
+++ /dev/null
@@ -1,47 +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 "mediawindow.hrc"
-
-String AVMEDIA_STR_INSERTMEDIA_DLG
-{
- Text[en-US] = "Insert Audio or Video";
-};
-
-String AVMEDIA_STR_OPENMEDIA_DLG
-{
- Text[en-US] = "Open Audio or Video";
-};
-
-String AVMEDIA_STR_ALL_MEDIAFILES
-{
- Text[en-US] = "All audio and video files";
-};
-
-String AVMEDIA_STR_ALL_FILES
-{
- Text[en-US] = "All files";
-};
-
-String AVMEDIA_STR_ERR_URL
-{
- Text[en-US] = "The format of the selected file is not supported.";
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index d362a5b7e0c0..13eb6626774f 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -23,8 +23,8 @@
#include "mediawindow_impl.hxx"
#include "mediaevent_impl.hxx"
#include "mediamisc.hxx"
+#include "strings.hrc"
#include "bitmaps.hlst"
-#include "mediawindow.hrc"
#include "helpids.hrc"
#include <algorithm>