summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-07 17:23:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-08 13:26:55 +0000
commit89e47b8bf1ba3f86204ae3ab997432c26b0eea6b (patch)
tree00a5810e2b8a044b6fe1a23ca0baecbf574bc140 /vcl/source
parent144fbefbf858ab6a680437fa69f406967b6ae9e3 (diff)
put .ui translations into the langpacks
and drop .ui suffix from the translation files Change-Id: I01e0e2f17c97584230b8da4ee0dd08a0444d77fd
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/builder.cxx54
1 files changed, 32 insertions, 22 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index dcef331df2f8..3e0fe3482414 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -73,44 +73,32 @@ namespace
}
}
-VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID)
- : m_sID(sID)
- , m_sHelpRoot(OUStringToOString(sUIFile, RTL_TEXTENCODING_UTF8))
- , m_sProductName(OUStringToOString(utl::ConfigManager::getProductName(), RTL_TEXTENCODING_UTF8))
- , m_pParent(pParent)
- , m_pParserState(new ParserState)
+void VclBuilder::loadTranslations(const com::sun::star::lang::Locale &rLocale, const OUString& rUri)
{
- m_bToplevelHasDeferredInit = (pParent && pParent->IsDialog()) ? ((Dialog*)pParent)->isDeferredInit() : false;
-
- sal_Int32 nIdx = m_sHelpRoot.lastIndexOf('.');
- if (nIdx != -1)
- m_sHelpRoot = m_sHelpRoot.copy(0, nIdx);
- m_sHelpRoot = m_sHelpRoot + OString('/');
-
- OUString sUri = sUIDir + sUIFile;
-
- ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
- for (int i = aLocale.Country.isEmpty() ? 1 : 0; i < 2; ++i)
+ for (int i = rLocale.Country.isEmpty() ? 1 : 0; i < 2; ++i)
{
OUStringBuffer aTransBuf;
- sal_Int32 nLastSlash = sUri.lastIndexOf('/');
+ sal_Int32 nLastSlash = rUri.lastIndexOf('/');
if (nLastSlash != -1)
- aTransBuf.append(sUri.copy(0, nLastSlash));
+ aTransBuf.append(rUri.copy(0, nLastSlash));
else
{
aTransBuf.append('.');
nLastSlash = 0;
}
- aTransBuf.append("/res/").append(aLocale.Language);
+ aTransBuf.append("/res/").append(rLocale.Language);
switch (i)
{
case 0:
- aTransBuf.append('-').append(aLocale.Country);
+ aTransBuf.append('-').append(rLocale.Country);
break;
default:
break;
}
- aTransBuf.append(sUri.copy(nLastSlash));
+ sal_Int32 nEndName = rUri.lastIndexOf('.');
+ if (nEndName == -1)
+ nEndName = rUri.getLength();
+ aTransBuf.append(rUri.copy(nLastSlash, nEndName-nLastSlash));
OUString sTransUri = aTransBuf.makeStringAndClear();
try
@@ -122,6 +110,28 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
{
}
}
+}
+
+VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID)
+ : m_sID(sID)
+ , m_sHelpRoot(OUStringToOString(sUIFile, RTL_TEXTENCODING_UTF8))
+ , m_sProductName(OUStringToOString(utl::ConfigManager::getProductName(), RTL_TEXTENCODING_UTF8))
+ , m_pParent(pParent)
+ , m_pParserState(new ParserState)
+{
+ m_bToplevelHasDeferredInit = (pParent && pParent->IsDialog()) ? ((Dialog*)pParent)->isDeferredInit() : false;
+
+ sal_Int32 nIdx = m_sHelpRoot.lastIndexOf('.');
+ if (nIdx != -1)
+ m_sHelpRoot = m_sHelpRoot.copy(0, nIdx);
+ m_sHelpRoot = m_sHelpRoot + OString('/');
+
+ OUString sUri = sUIDir + sUIFile;
+
+ com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+ bool bEN_US = aLocale.Language == "en" && aLocale.Country == "US" && aLocale.Variant.isEmpty();
+ if (!bEN_US)
+ loadTranslations(aLocale, sUri);
xmlreader::XmlReader reader(sUri);