Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kfileitemmodel.cpp
Show First 20 Lines • Show All 2040 Lines • ▼ Show 20 Line(s) | 2040 | default: | |||
---|---|---|---|---|---|
2041 | Q_ASSERT(false); | 2041 | Q_ASSERT(false); | ||
2042 | } | 2042 | } | ||
2043 | } else { | 2043 | } else { | ||
2044 | const QDate lastMonthDate = currentDate.addMonths(-1); | 2044 | const QDate lastMonthDate = currentDate.addMonths(-1); | ||
2045 | if (lastMonthDate.year() == fileDate.year() && | 2045 | if (lastMonthDate.year() == fileDate.year() && | ||
2046 | lastMonthDate.month() == fileDate.month()) { | 2046 | lastMonthDate.month() == fileDate.month()) { | ||
2047 | 2047 | | |||
2048 | if (daysDistance == 1) { | 2048 | if (daysDistance == 1) { | ||
2049 | newGroupValue = fileTime.toString(i18nc("@title:group Date: " | 2049 | const KLocalizedString format = ki18nc("@title:group Date: " | ||
2050 | "MMMM is full month name in current locale, and yyyy is " | 2050 | "MMMM is full month name in current locale, and yyyy is " | ||
2051 | "full year number", "'Yesterday' (MMMM, yyyy)")); | 2051 | "full year number", "'Yesterday' (MMMM, yyyy)"); | ||
2052 | const QString translatedFormat = format.toString(); | ||||
2053 | if (translatedFormat.count(QLatin1Char('\'')) == 2) { | ||||
2054 | newGroupValue = fileTime.toString(translatedFormat); | ||||
2052 | newGroupValue = i18nc("Can be used to script translation of " | 2055 | newGroupValue = i18nc("Can be used to script translation of " | ||
2053 | "\"'Yesterday' (MMMM, yyyy)\" with context @title:group Date", | 2056 | "\"'Yesterday' (MMMM, yyyy)\" with context @title:group Date", | ||
2054 | "%1", newGroupValue); | 2057 | "%1", newGroupValue); | ||
2058 | } else { | ||||
2059 | qCWarning(DolphinDebug).nospace() << "A wrong translation was found: " << translatedFormat << ". Please file a bug report at bugs.kde.org"; | ||||
aacid: Sorry for being the most nitpicky person ever, should we include translatedFormat here (and the… | |||||
2060 | const QString untranslatedFormat = format.toString({ QLatin1String("en_US") }); | ||||
2061 | newGroupValue = fileTime.toString(untranslatedFormat); | ||||
2062 | } | ||||
2055 | } else if (daysDistance <= 7) { | 2063 | } else if (daysDistance <= 7) { | ||
2056 | newGroupValue = fileTime.toString(i18nc("@title:group Date: " | 2064 | newGroupValue = fileTime.toString(i18nc("@title:group Date: " | ||
2057 | "The week day name: dddd, MMMM is full month name " | 2065 | "The week day name: dddd, MMMM is full month name " | ||
2058 | "in current locale, and yyyy is full year number", | 2066 | "in current locale, and yyyy is full year number", | ||
2059 | "dddd (MMMM, yyyy)")); | 2067 | "dddd (MMMM, yyyy)")); | ||
2060 | newGroupValue = i18nc("Can be used to script translation of " | 2068 | newGroupValue = i18nc("Can be used to script translation of " | ||
2061 | "\"dddd (MMMM, yyyy)\" with context @title:group Date", | 2069 | "\"dddd (MMMM, yyyy)\" with context @title:group Date", | ||
2062 | "%1", newGroupValue); | 2070 | "%1", newGroupValue); | ||
2063 | } else if (daysDistance <= 7 * 2) { | 2071 | } else if (daysDistance <= 7 * 2) { | ||
2064 | newGroupValue = fileTime.toString(i18nc("@title:group Date: " | 2072 | const KLocalizedString format = ki18nc("@title:group Date: " | ||
2065 | "MMMM is full month name in current locale, and yyyy is " | 2073 | "MMMM is full month name in current locale, and yyyy is " | ||
2066 | "full year number", "'One Week Ago' (MMMM, yyyy)")); | 2074 | "full year number", "'One Week Ago' (MMMM, yyyy)"); | ||
2075 | const QString translatedFormat = format.toString(); | ||||
2076 | if (translatedFormat.count(QLatin1Char('\'')) == 2) { | ||||
2077 | newGroupValue = fileTime.toString(translatedFormat); | ||||
2067 | newGroupValue = i18nc("Can be used to script translation of " | 2078 | newGroupValue = i18nc("Can be used to script translation of " | ||
2068 | "\"'One Week Ago' (MMMM, yyyy)\" with context @title:group Date", | 2079 | "\"'One Week Ago' (MMMM, yyyy)\" with context @title:group Date", | ||
2069 | "%1", newGroupValue); | 2080 | "%1", newGroupValue); | ||
2081 | } else { | ||||
2082 | qCWarning(DolphinDebug).nospace() << "A wrong translation was found: " << translatedFormat << ". Please file a bug report at bugs.kde.org"; | ||||
2083 | const QString untranslatedFormat = format.toString({ QLatin1String("en_US") }); | ||||
2084 | newGroupValue = fileTime.toString(untranslatedFormat); | ||||
2085 | } | ||||
2070 | } else if (daysDistance <= 7 * 3) { | 2086 | } else if (daysDistance <= 7 * 3) { | ||
2071 | newGroupValue = fileTime.toString(i18nc("@title:group Date: " | 2087 | const KLocalizedString format = ki18nc("@title:group Date: " | ||
2072 | "MMMM is full month name in current locale, and yyyy is " | 2088 | "MMMM is full month name in current locale, and yyyy is " | ||
2073 | "full year number", "'Two Weeks Ago' (MMMM, yyyy)")); | 2089 | "full year number", "'Two Weeks Ago' (MMMM, yyyy)"); | ||
2090 | const QString translatedFormat = format.toString(); | ||||
2091 | if (translatedFormat.count(QLatin1Char('\'')) == 2) { | ||||
2092 | newGroupValue = fileTime.toString(translatedFormat); | ||||
2074 | newGroupValue = i18nc("Can be used to script translation of " | 2093 | newGroupValue = i18nc("Can be used to script translation of " | ||
2075 | "\"'Two Weeks Ago' (MMMM, yyyy)\" with context @title:group Date", | 2094 | "\"'Two Weeks Ago' (MMMM, yyyy)\" with context @title:group Date", | ||
2076 | "%1", newGroupValue); | 2095 | "%1", newGroupValue); | ||
2096 | } else { | ||||
2097 | qCWarning(DolphinDebug).nospace() << "A wrong translation was found: " << translatedFormat << ". Please file a bug report at bugs.kde.org"; | ||||
2098 | const QString untranslatedFormat = format.toString({ QLatin1String("en_US") }); | ||||
2099 | newGroupValue = fileTime.toString(untranslatedFormat); | ||||
2100 | } | ||||
2077 | } else if (daysDistance <= 7 * 4) { | 2101 | } else if (daysDistance <= 7 * 4) { | ||
2078 | newGroupValue = fileTime.toString(i18nc("@title:group Date: " | 2102 | const KLocalizedString format = ki18nc("@title:group Date: " | ||
2079 | "MMMM is full month name in current locale, and yyyy is " | 2103 | "MMMM is full month name in current locale, and yyyy is " | ||
2080 | "full year number", "'Three Weeks Ago' (MMMM, yyyy)")); | 2104 | "full year number", "'Three Weeks Ago' (MMMM, yyyy)"); | ||
2105 | const QString translatedFormat = format.toString(); | ||||
2106 | if (translatedFormat.count(QLatin1Char('\'')) == 2) { | ||||
2107 | newGroupValue = fileTime.toString(translatedFormat); | ||||
2081 | newGroupValue = i18nc("Can be used to script translation of " | 2108 | newGroupValue = i18nc("Can be used to script translation of " | ||
2082 | "\"'Three Weeks Ago' (MMMM, yyyy)\" with context @title:group Date", | 2109 | "\"'Three Weeks Ago' (MMMM, yyyy)\" with context @title:group Date", | ||
2083 | "%1", newGroupValue); | 2110 | "%1", newGroupValue); | ||
2084 | } else { | 2111 | } else { | ||
2085 | newGroupValue = fileTime.toString(i18nc("@title:group Date: " | 2112 | qCWarning(DolphinDebug).nospace() << "A wrong translation was found: " << translatedFormat << ". Please file a bug report at bugs.kde.org"; | ||
2113 | const QString untranslatedFormat = format.toString({ QLatin1String("en_US") }); | ||||
2114 | newGroupValue = fileTime.toString(untranslatedFormat); | ||||
2115 | } | ||||
2116 | } else { | ||||
2117 | const KLocalizedString format = ki18nc("@title:group Date: " | ||||
2086 | "MMMM is full month name in current locale, and yyyy is " | 2118 | "MMMM is full month name in current locale, and yyyy is " | ||
2087 | "full year number", "'Earlier on' MMMM, yyyy")); | 2119 | "full year number", "'Earlier on' MMMM, yyyy"); | ||
2120 | const QString translatedFormat = format.toString(); | ||||
2121 | if (translatedFormat.count(QLatin1Char('\'')) == 2) { | ||||
2122 | newGroupValue = fileTime.toString(translatedFormat); | ||||
2088 | newGroupValue = i18nc("Can be used to script translation of " | 2123 | newGroupValue = i18nc("Can be used to script translation of " | ||
2089 | "\"'Earlier on' MMMM, yyyy\" with context @title:group Date", | 2124 | "\"'Earlier on' MMMM, yyyy\" with context @title:group Date", | ||
2090 | "%1", newGroupValue); | 2125 | "%1", newGroupValue); | ||
2126 | } else { | ||||
2127 | qCWarning(DolphinDebug).nospace() << "A wrong translation was found: " << translatedFormat << ". Please file a bug report at bugs.kde.org"; | ||||
2128 | const QString untranslatedFormat = format.toString({ QLatin1String("en_US") }); | ||||
2129 | newGroupValue = fileTime.toString(untranslatedFormat); | ||||
2130 | } | ||||
2091 | } | 2131 | } | ||
2092 | } else { | 2132 | } else { | ||
2093 | newGroupValue = fileTime.toString(i18nc("@title:group " | 2133 | newGroupValue = fileTime.toString(i18nc("@title:group " | ||
2094 | "The month and year: MMMM is full month name in current locale, " | 2134 | "The month and year: MMMM is full month name in current locale, " | ||
2095 | "and yyyy is full year number", "MMMM, yyyy")); | 2135 | "and yyyy is full year number", "MMMM, yyyy")); | ||
2096 | newGroupValue = i18nc("Can be used to script translation of " | 2136 | newGroupValue = i18nc("Can be used to script translation of " | ||
2097 | "\"MMMM, yyyy\" with context @title:group Date", | 2137 | "\"MMMM, yyyy\" with context @title:group Date", | ||
2098 | "%1", newGroupValue); | 2138 | "%1", newGroupValue); | ||
▲ Show 20 Lines • Show All 282 Lines • Show Last 20 Lines |
Sorry for being the most nitpicky person ever, should we include translatedFormat here (and the rest of the warning messages)?
Seems like it could be useful