sfx2/source/view/classificationhelper.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
New commits: commit c9a16da8617634955eacded60083bec7ffd8b58b Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Jun 21 09:16:26 2016 +0200 tdf#100352 sfx classification: support localized policy files The example policy is at: instdir/share/classification/example.xml If there is a localized version, e.g.: instdir/share/classification/example_hu-HU.xml (same syntax as already used for the autocorrect files), then use that instead of the configured policy. (cherry picked from commit 1811e656f08ba011a3c2a51cc60e90d2fa58e4c2) Change-Id: I0369e69f90a633af0676981f0c5760f8477b3c8c Reviewed-on: https://gerrit.libreoffice.org/26549 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index 0c93e93..8a3bc96 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -33,6 +33,7 @@ #include <tools/datetime.hxx> #include <unotools/datetime.hxx> #include <vcl/layout.hxx> +#include <svl/fstathelper.hxx> #include <config_folders.h> using namespace com::sun::star; @@ -355,6 +356,19 @@ void SfxClassificationHelper::Impl::parsePolicy() uno::Reference<uno::XComponentContext> xComponentContext = comphelper::getProcessComponentContext(); SvtPathOptions aOptions; OUString aPath = aOptions.GetClassificationPath(); + + // See if there is a localized variant next to the configured XML. + OUString aExtension(".xml"); + if (aPath.endsWith(aExtension)) + { + OUString aBase = aPath.copy(0, aPath.getLength() - aExtension.getLength()); + const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag(); + // Expected format is "<original path>_xx-XX.xml". + OUString aLocalized = aBase + "_" + rLanguageTag.getBcp47() + aExtension; + if (FStatHelper::IsDocument(aLocalized)) + aPath = aLocalized; + } + SvStream* pStream = utl::UcbStreamHelper::CreateStream(aPath, StreamMode::READ); uno::Reference<io::XInputStream> xInputStream(new utl::OStreamWrapper(*pStream)); xml::sax::InputSource aParserInput;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits