mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 620627 PlacesSQLQueryBuilder::SelectAsDay() is not l12y friendly.
Further modified by Marco Bonardo (f=gandalf) r=mak
This commit is contained in:
parent
83e900946a
commit
e4ba3540e8
@ -3270,9 +3270,9 @@ PlacesSQLQueryBuilder::SelectAsDay()
|
||||
"FROM (", // TOUTER BEGIN
|
||||
resultType,
|
||||
sortingMode);
|
||||
|
||||
nsNavHistory *history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_STATE(history);
|
||||
|
||||
nsNavHistory *history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_STATE(history);
|
||||
|
||||
PRInt32 daysOfHistory = history->GetDaysOfHistory();
|
||||
for (PRInt32 i = 0; i <= HISTORY_DATE_CONT_NUM(daysOfHistory); i++) {
|
||||
@ -3380,12 +3380,15 @@ PlacesSQLQueryBuilder::SelectAsDay()
|
||||
// day of each month. Using LocalTimeParameters would instead force us
|
||||
// to apply a DST correction that we don't really need here.
|
||||
PR_NormalizeTime(&tm, PR_GMTParameters);
|
||||
// tm_month starts from 0 while GetMonthName expects a 1-based index.
|
||||
history->GetMonthName(tm.tm_month+1, dateName);
|
||||
|
||||
// If the container is for a past year, add the year as suffix.
|
||||
if (tm.tm_year < currentYear)
|
||||
dateName.Append(nsPrintfCString(" %d", tm.tm_year));
|
||||
// If the container is for a past year, add the year to its title,
|
||||
// otherwise just show the month name.
|
||||
// Note that tm_month starts from 0, while we need a 1-based index.
|
||||
if (tm.tm_year < currentYear) {
|
||||
history->GetMonthYear(tm.tm_month + 1, tm.tm_year, dateName);
|
||||
}
|
||||
else {
|
||||
history->GetMonthName(tm.tm_month + 1, dateName);
|
||||
}
|
||||
|
||||
// From start of MonthIndex + 1 months ago
|
||||
sqlFragmentContainerBeginTime = NS_LITERAL_CSTRING(
|
||||
@ -6689,6 +6692,31 @@ nsNavHistory::GetMonthName(PRInt32 aIndex, nsACString& aResult)
|
||||
aResult = nsPrintfCString("[%d]", aIndex);
|
||||
}
|
||||
|
||||
void
|
||||
nsNavHistory::GetMonthYear(PRInt32 aMonth, PRInt32 aYear, nsACString& aResult)
|
||||
{
|
||||
nsIStringBundle *bundle = GetBundle();
|
||||
if (bundle) {
|
||||
nsCAutoString monthName;
|
||||
GetMonthName(aMonth, monthName);
|
||||
nsAutoString yearString;
|
||||
yearString.AppendInt(aYear);
|
||||
const PRUnichar* strings[2] = {
|
||||
NS_ConvertUTF8toUTF16(monthName).get()
|
||||
, yearString.get()
|
||||
};
|
||||
nsXPIDLString value;
|
||||
if (NS_SUCCEEDED(bundle->FormatStringFromName(
|
||||
NS_LITERAL_STRING("finduri-MonthYear").get(), strings, 2,
|
||||
getter_Copies(value)
|
||||
))) {
|
||||
CopyUTF16toUTF8(value, aResult);
|
||||
return;
|
||||
}
|
||||
}
|
||||
aResult.AppendLiteral("finduri-MonthYear");
|
||||
}
|
||||
|
||||
// nsNavHistory::SetPageTitleInternal
|
||||
//
|
||||
// Called to set the title for the given URI. Used as a
|
||||
|
@ -281,6 +281,7 @@ public:
|
||||
void GetAgeInDaysString(PRInt32 aInt, const PRUnichar *aName,
|
||||
nsACString& aResult);
|
||||
void GetMonthName(PRInt32 aIndex, nsACString& aResult);
|
||||
void GetMonthYear(PRInt32 aMonth, PRInt32 aYear, nsACString& aResult);
|
||||
|
||||
// Returns whether history is enabled or not.
|
||||
PRBool IsHistoryDisabled() {
|
||||
|
@ -12,6 +12,9 @@ finduri-AgeInDays-last-is=Last %S days
|
||||
finduri-AgeInDays-isgreater=Older than %S days
|
||||
finduri-AgeInMonths-is-0=This month
|
||||
finduri-AgeInMonths-isgreater=Older than %S months
|
||||
# LOCALIZATION NOTE (finduri-MonthYear):
|
||||
# %1$S is the month name, %2$S is the year (4 digits format).
|
||||
finduri-MonthYear=%1$S %2$S
|
||||
|
||||
# LOCALIZATION NOTE (localFiles):
|
||||
# This is used to generate local files container when history is grouped by site
|
||||
|
Loading…
Reference in New Issue
Block a user