summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-12-21 17:29:30 +0100
committerOlivier Hallot <olivier.hallot@libreoffice.org>2017-09-13 01:53:47 +0200
commita0f51dc3a480715a868aa024f6d17d6f2e78d0bf (patch)
tree6246452b58f67a30ef7ca287a2508e61827b3d32 /l10ntools
parent1aaa0fa8218a8bd13b191999080c9a95939667f0 (diff)
Use "en-US" as the default for XHP's xml-lang attribute.
Change-Id: I765e1cc25ac79d2cebf54f7a247a200647c984da Reviewed-on: https://gerrit.libreoffice.org/32296 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org> Tested-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/xmlparse.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 809aa62fd8a8..16f6ced20ec8 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -330,7 +330,7 @@ void XMLFile::Extract()
void XMLFile::InsertL10NElement( XMLElement* pElement )
{
- OString sId, sLanguage("");
+ OString sId, sLanguage("en-US");
LangHashMap* pElem;
if( pElement->GetAttributeList() != nullptr )
@@ -445,7 +445,8 @@ void XMLFile::SearchL10NElements( XMLChildNode *pCur )
bool bInsert = true;
XMLElement *pElement = static_cast<XMLElement*>(pCur);
const OString sName(pElement->GetName().toAsciiLowerCase());
- OString sLanguage, sTmpStrVal;
+ OString sLanguage("en-US");
+ OString sTmpStrVal;
if ( pElement->GetAttributeList())
{
for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; ++j )
@@ -603,11 +604,18 @@ void XMLElement::ChangeLanguageTag( const OString &rValue )
SetLanguageId(rValue);
if ( m_pAttributes )
{
+ bool bWasSet = false;
for (size_t i = 0; i < m_pAttributes->size(); ++i)
{
- if ( (*m_pAttributes)[ i ]->GetName() == "xml-lang" )
+ if ((*m_pAttributes)[ i ]->GetName() == XML_LANG)
+ {
(*m_pAttributes)[ i ]->setValue(rValue);
+ bWasSet = true;
+ }
}
+
+ if (!bWasSet)
+ AddAttribute(XML_LANG, rValue);
}
XMLChildNodeList* pCList = GetChildList();
@@ -681,7 +689,7 @@ void XMLElement::Print(XMLNode *pCur, OStringBuffer& rBuffer, bool bRootelement
for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ )
{
const OString aAttrName( (*pElement->GetAttributeList())[ j ]->GetName() );
- if( !aAttrName.equalsIgnoreAsciiCase( "xml-lang" ) )
+ if (!aAttrName.equalsIgnoreAsciiCase(XML_LANG))
{
rBuffer.append(
" " + aAttrName + "=\"" +