aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/LangInfo.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/xbmc/LangInfo.cpp b/xbmc/LangInfo.cpp
index 27596cbdb8..d5ebf014ae 100644
--- a/xbmc/LangInfo.cpp
+++ b/xbmc/LangInfo.cpp
@@ -35,6 +35,16 @@
#include <algorithm>
#include <stdexcept>
+namespace
+{
+std::string GetDateStringWithFormat(const CDateTime& date, const std::string& format)
+{
+ // Return the formatted date together with the format used.
+ // eg: '1/02/2003 (D/MM/YYYY)'
+ return date.GetAsLocalizedDate(format) + " (" + format + ")";
+}
+} // namespace
+
using namespace PVR;
static std::string shortDateFormats[] = {
@@ -1288,10 +1298,11 @@ void CLangInfo::SettingOptionsShortDateFormatsFiller(const SettingConstPtr& sett
CDateTime now = CDateTime::GetCurrentDateTime();
- list.emplace_back(
- StringUtils::Format(g_localizeStrings.Get(20035),
- now.GetAsLocalizedDate(g_langInfo.m_currentRegion->m_strDateFormatShort)),
- SETTING_REGIONAL_DEFAULT);
+ list.emplace_back(StringUtils::Format(g_localizeStrings.Get(20035),
+ GetDateStringWithFormat(
+ now, g_langInfo.m_currentRegion->m_strDateFormatShort)),
+ SETTING_REGIONAL_DEFAULT);
+
if (shortDateFormatSetting == SETTING_REGIONAL_DEFAULT)
{
match = true;
@@ -1300,7 +1311,7 @@ void CLangInfo::SettingOptionsShortDateFormatsFiller(const SettingConstPtr& sett
for (const std::string& shortDateFormat : shortDateFormats)
{
- list.emplace_back(now.GetAsLocalizedDate(shortDateFormat), shortDateFormat);
+ list.emplace_back(GetDateStringWithFormat(now, shortDateFormat), shortDateFormat);
if (!match && shortDateFormatSetting == shortDateFormat)
{
@@ -1323,10 +1334,11 @@ void CLangInfo::SettingOptionsLongDateFormatsFiller(const SettingConstPtr& setti
CDateTime now = CDateTime::GetCurrentDateTime();
- list.emplace_back(
- StringUtils::Format(g_localizeStrings.Get(20035),
- now.GetAsLocalizedDate(g_langInfo.m_currentRegion->m_strDateFormatLong)),
- SETTING_REGIONAL_DEFAULT);
+ list.emplace_back(StringUtils::Format(g_localizeStrings.Get(20035),
+ GetDateStringWithFormat(
+ now, g_langInfo.m_currentRegion->m_strDateFormatLong)),
+ SETTING_REGIONAL_DEFAULT);
+
if (longDateFormatSetting == SETTING_REGIONAL_DEFAULT)
{
match = true;
@@ -1335,7 +1347,7 @@ void CLangInfo::SettingOptionsLongDateFormatsFiller(const SettingConstPtr& setti
for (const std::string& longDateFormat : longDateFormats)
{
- list.emplace_back(now.GetAsLocalizedDate(longDateFormat), longDateFormat);
+ list.emplace_back(GetDateStringWithFormat(now, longDateFormat), longDateFormat);
if (!match && longDateFormatSetting == longDateFormat)
{