xmloff/source/meta/xmlmetae.cxx | 10 +------- xmloff/source/style/xmlnumfe.cxx | 7 ++++- xmlscript/Library_xmlscript.mk | 1 xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 26 ++++++++++++--------- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 12 ++++++--- 5 files changed, 31 insertions(+), 25 deletions(-)
New commits: commit 6c88ebe9aaf32b5c7c6e22270ee90091c019f567 Author: Eike Rathke <er...@redhat.com> Date: Fri Jul 12 12:29:45 2013 +0200 write bcp47 format-locale if necessary and read both Change-Id: I82cfdd8652d1c86b701ccb0b913928c860a360d2 diff --git a/xmlscript/Library_xmlscript.mk b/xmlscript/Library_xmlscript.mk index fa680d1..640b561 100644 --- a/xmlscript/Library_xmlscript.mk +++ b/xmlscript/Library_xmlscript.mk @@ -21,6 +21,7 @@ $(eval $(call gb_Library_use_libraries,xmlscript,\ cppuhelper \ sal \ tl \ + i18nlangtag \ $(gb_UWINAPI) \ )) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index 05c724a..8f7c284 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -58,6 +58,7 @@ #include <com/sun/star/document/GraphicObjectResolver.hpp> #include <comphelper/processfactory.hxx> +#include <i18nlangtag/languagetag.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -485,19 +486,22 @@ void ElementDescriptor::addNumberFormatAttr( addAttribute(XMLNS_DIALOGS_PREFIX ":format-code", sFormat ); // format-locale - OUStringBuffer buf( 48 ); - buf.append( locale.Language ); - if (!locale.Country.isEmpty()) + LanguageTag aLanguageTag( locale); + OUString aStr; + if (aLanguageTag.isIsoLocale()) { - buf.append( (sal_Unicode)';' ); - buf.append( locale.Country ); - if (!locale.Variant.isEmpty()) - { - buf.append( (sal_Unicode)';' ); - buf.append( locale.Variant ); - } + // Old style "lll;CC" for compatibility, I really don't know what may + // consume this. + if (aLanguageTag.getCountry().isEmpty()) + aStr = aLanguageTag.getLanguage(); + else + aStr = aLanguageTag.getLanguage() + ";" + aLanguageTag.getCountry(); + } + else + { + aStr = aLanguageTag.getBcp47( false); } - addAttribute( XMLNS_DIALOGS_PREFIX ":format-locale", buf.makeStringAndClear() ); + addAttribute( XMLNS_DIALOGS_PREFIX ":format-locale", aStr ); } //__________________________________________________________________________________________________ Any ElementDescriptor::readProp( OUString const & rPropName ) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index bc8193a..d690206 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/script/vba/XVBACompatibility.hpp> #include <comphelper/processfactory.hxx> +#include <i18nlangtag/languagetag.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -539,21 +540,24 @@ void FormattedFieldElement::endElement() if (!sLocale.isEmpty()) { // split locale + // Don't know what may have written what we read here, so parse all + // old style including the trailing ";Variant" if present. sal_Int32 semi0 = sLocale.indexOf( ';' ); - if (semi0 < 0) // no semi at all, just try language + if (semi0 < 0) // no semi at all, try new BCP47 or just language { - locale.Language = sLocale; + locale = LanguageTag( sLocale).getLocale( false); } else { sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 ); if (semi1 > semi0) // language;country;variant { + SAL_WARN( "xmlscript.xmldlg", "format-locale with variant that is ignored: " << sLocale); locale.Language = sLocale.copy( 0, semi0 ); locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 ); - locale.Variant = sLocale.copy( semi1 +1 ); + // Ignore Variant that no one knows what it would be. } - else // try language;country + else // language;country { locale.Language = sLocale.copy( 0, semi0 ); locale.Country = sLocale.copy( semi0 +1 ); commit 76d36d5bba2712c1c98548e73ca9fb82e11b0cca Author: Eike Rathke <er...@redhat.com> Date: Fri Jul 12 11:29:43 2013 +0200 write ISO codes for native number transliteration Change-Id: Idc3bf2aabb7df4e57deb13251a1f6631c579268c diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index a23e94b..ea4e0ca 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -1109,12 +1109,15 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt { /* FIXME-BCP47: ODF defines no transliteration-script or * transliteration-rfc-language-tag */ + LanguageTag aLanguageTag( aAttr.Locale); + OUString aLanguage, aScript, aCountry; + aLanguageTag.getIsoLanguageScriptCountry( aLanguage, aScript, aCountry); rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_FORMAT, aAttr.Format ); rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_LANGUAGE, - aAttr.Locale.Language ); + aLanguage ); rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_COUNTRY, - aAttr.Locale.Country ); + aCountry ); rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_STYLE, aAttr.Style ); } commit 2c5548a6fb0886f32cf20609638d171c43a6d1af Author: Eike Rathke <er...@redhat.com> Date: Fri Jul 12 11:22:35 2013 +0200 write bcp47 to dc:language Change-Id: Ia62ef327cd07070c2e48f4140c58f3309581b562 diff --git a/xmloff/source/meta/xmlmetae.cxx b/xmloff/source/meta/xmlmetae.cxx index cae4ee1..efe634c 100644 --- a/xmloff/source/meta/xmlmetae.cxx +++ b/xmloff/source/meta/xmlmetae.cxx @@ -18,7 +18,7 @@ */ #include <tools/debug.hxx> -#include <i18nlangtag/mslangid.hxx> +#include <i18nlangtag/languagetag.hxx> #include <rtl/ustrbuf.hxx> #include <xmloff/xmlmetae.hxx> @@ -148,14 +148,8 @@ void SvXMLMetaExport::_MExport() // document language { - const lang::Locale aLocale = mxDocProps->getLanguage(); - OUString sValue = aLocale.Language; + OUString sValue = LanguageTag( mxDocProps->getLanguage()).getBcp47( false); if (!sValue.isEmpty()) { - if ( !aLocale.Country.isEmpty() ) - { - sValue += OUString::valueOf((sal_Unicode)'-'); - sValue += aLocale.Country; - } SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DC, XML_LANGUAGE, sal_True, sal_False ); mrExport.Characters( sValue ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits