Skip to content

Commit

Permalink
Merge pull request xbmc#6524 from Montellese/addons_fix_language_filter
Browse files Browse the repository at this point in the history
[win32] addons: fix filtering foreign language addons
  • Loading branch information
Montellese committed Feb 23, 2015
2 parents 1f7566a + 978cb20 commit 5e459f2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
7 changes: 2 additions & 5 deletions xbmc/LangInfo.cpp
Expand Up @@ -535,12 +535,9 @@ const std::string CLangInfo::GetDVDSubtitleLanguage() const
return code;
}

const std::string CLangInfo::GetLanguageLocale(bool twochar /* = false */) const
const std::string& CLangInfo::GetLanguageLocale() const
{
if (twochar)
return m_currentRegion->m_strLangLocaleCodeTwoChar;

return m_currentRegion->m_strLangLocaleName;
return m_currentRegion->m_strLangLocaleCodeTwoChar;
}

const std::string& CLangInfo::GetRegionLocale() const
Expand Down
6 changes: 5 additions & 1 deletion xbmc/LangInfo.h
Expand Up @@ -76,7 +76,11 @@ class CLangInfo : public ISettingCallback
const std::string& GetTimeZone() const;

const std::string& GetRegionLocale() const;
const std::string GetLanguageLocale(bool twochar = false) const;

/*!
\brief Returns the two character ISO 639-1 language code of the current language.
*/
const std::string& GetLanguageLocale() const;

bool ForceUnicodeFont() const { return m_currentRegion->m_forceUnicodeFont; }

Expand Down
2 changes: 1 addition & 1 deletion xbmc/addons/AddonManager.cpp
Expand Up @@ -631,7 +631,7 @@ std::string CAddonMgr::GetTranslatedString(const cp_cfg_element_t *root, const c
if (strcmp(tag, child.name) == 0)
{ // see if we have a "lang" attribute
const char *lang = m_cpluff->lookup_cfg_value((cp_cfg_element_t*)&child, "@lang");
if (lang && 0 == strcmp(lang,g_langInfo.GetLanguageLocale(true).c_str()))
if (lang && 0 == strcmp(lang,g_langInfo.GetLanguageLocale().c_str()))
return child.value ? child.value : "";
if (!lang || 0 == strcmp(lang, "en"))
eng = &child;
Expand Down
7 changes: 2 additions & 5 deletions xbmc/addons/GUIWindowAddonBrowser.cpp
Expand Up @@ -375,11 +375,8 @@ bool CGUIWindowAddonBrowser::GetDirectory(const std::string& strDirectory,
int i=0;
while (i < items.Size())
{
if (!FilterVar(CSettings::Get().GetBool("general.addonforeignfilter"),
items[i]->GetProperty("Addon.Language"), "en") ||
!FilterVar(CSettings::Get().GetBool("general.addonforeignfilter"),
items[i]->GetProperty("Addon.Language"),
g_langInfo.GetLanguageLocale()))
if (!FilterVar(true, items[i]->GetProperty("Addon.Language"), "en") ||
!FilterVar(true, items[i]->GetProperty("Addon.Language"), g_langInfo.GetLanguageLocale()))
{
i++;
}
Expand Down

0 comments on commit 5e459f2

Please sign in to comment.