Add translation hints for time format strings.

Also mark Add-On Manager time string for translation.
Resolves #6246.
This commit is contained in:
Wedge009 2021-11-02 10:19:16 +11:00
parent 6cf37037f2
commit 7a61d7888c
3 changed files with 14 additions and 4 deletions

View file

@ -44,25 +44,31 @@ std::string format_time_summary(std::time_t t) {
if(days_apart == 0) {
// save is from today
if(preferences::use_twelve_hour_clock_format() == false) {
// TRANSLATORS: 24-hour time, eg '13:59'
format_string = _("%H:%M");
}
else {
// TRANSLATORS: 12-hour time, eg '1:59 PM'
format_string = _("%I:%M %p");
}
} else if(days_apart > 0 && days_apart <= current_time.tm_wday) {
// save is from this week
if(preferences::use_twelve_hour_clock_format() == false) {
// TRANSLATORS: Day of week + 24-hour time, eg 'Sunday, 13:59'
format_string = _("%A, %H:%M");
}
else {
// TRANSLATORS: Day of week + 12-hour time, eg 'Sunday, 1:59 PM'
format_string = _("%A, %I:%M %p");
}
} else {
// save is from current year
// TRANSLATORS: Month + day of month, eg 'Nov 02'. Format for your locale.
format_string = _("%b %d");
}
} else {
// save is from a different year
// TRANSLATORS: Month + day of month + year, eg 'Nov 02 2021'. Format for your locale.
format_string = _("%b %d %Y");
}
assert(!format_string.empty());

View file

@ -955,11 +955,13 @@ static std::string format_addon_time(std::time_t time)
if(time) {
std::ostringstream ss;
const char* format = preferences::use_twelve_hour_clock_format()
? "%B %d %Y, %I:%M %p"
: "%B %d %Y, %H:%M";
const std::string format = preferences::use_twelve_hour_clock_format()
// TRANSLATORS: Month + day of month + year + 12-hour time, eg 'November 02 2021, 1:59 PM'. Format for your locale.
? _("%B %d %Y, %I:%M %p")
// TRANSLATORS: Month + day of month + year + 24-hour time, eg 'November 02 2021, 13:59'. Format for your locale.
: _("%B %d %Y, %H:%M");
ss << std::put_time(std::localtime(&time), format);
ss << translation::strftime(format, std::localtime(&time));
return ss.str();
}

View file

@ -253,7 +253,9 @@ std::string save_info::format_time_local() const
{
if(std::tm* tm_l = std::localtime(&modified())) {
const std::string format = preferences::use_twelve_hour_clock_format()
// TRANSLATORS: Day of week + month + day of month + year + 12-hour time, eg 'Tue Nov 02 2021, 1:59 PM'. Format for your locale.
? _("%a %b %d %Y, %I:%M %p")
// TRANSLATORS: Day of week + month + day of month + year + 24-hour time, eg 'Tue Nov 02 2021, 13:59'. Format for your locale.
: _("%a %b %d %Y, %H:%M");
return translation::strftime(format, tm_l);