Fix bug 491254 - Some languages need weekdays in plural form for some particular sentences inside Recurrence Summary. r=philipp

This commit is contained in:
Decathlon 2010-02-18 15:37:55 +01:00
Родитель 796b05279b
Коммит a7882724fe
2 изменённых файлов: 46 добавлений и 3 удалений

Просмотреть файл

@ -89,6 +89,10 @@ function recurrenceRule2String(recurrenceInfo, startDate, endDate, allDay) {
return aRuleString + nounClass.substr(0, 1).toUpperCase() +
nounClass.substr(1);
}
function pluralWeekday(aDayString) {
let plural = getRString("pluralForWeekdays") == "true";
return (plural ? aDayString + "Plural" : aDayString);
}
let ruleString;
if (rule.type == 'DAILY') {
@ -124,7 +128,11 @@ function recurrenceRule2String(recurrenceInfo, startDate, endDate, allDay) {
// first day of the list
let weeklyString = nounClass("repeatDetailsDay" + days[0], "weeklyNthOn");
for (let i = 0; i < days.length; i++) {
weekdays += getRString("repeatDetailsDay" + days[i]);
if (rule.interval == 1) {
weekdays += getRString(pluralWeekday("repeatDetailsDay" + days[i]));
} else {
weekdays += getRString("repeatDetailsDay" + days[i]);
}
if (days.length > 1 && i == (days.length - 2)) {
weekdays += ' ' + getRString("repeatDetailsAnd") + ' ';
} else if (i < days.length - 1) {
@ -148,7 +156,7 @@ function recurrenceRule2String(recurrenceInfo, startDate, endDate, allDay) {
// i.e every MONDAY of every N months
let monthlyString = "monthlyEveryOfEvery";
let dayString = "repeatDetailsDay" + day_of_week(byday[0]);
let day = getRString(dayString);
let day = getRString(pluralWeekday(dayString));
monthlyString = nounClass(dayString, monthlyString);
monthlyString = getRString(monthlyString, [day]);
ruleString = PluralForm.get(rule.interval, monthlyString)
@ -240,11 +248,11 @@ function recurrenceRule2String(recurrenceInfo, startDate, endDate, allDay) {
if (bymonth.length == 1 && byday.length == 1) {
let dayString = "repeatDetailsDay" + day_of_week(byday[0]);
let day = getRString(dayString);
let month = getRString("repeatDetailsMonth" + bymonth[0]);
if (day_position(byday[0]) == 0) {
let yearlyString = "yearlyOnEveryNthOfNth";
yearlyString = nounClass(dayString, yearlyString);
let day = getRString(pluralWeekday(dayString));
yearlyString = getRString(yearlyString, [day, month]);
ruleString = PluralForm.get(rule.interval, yearlyString)
.replace("#3", rule.interval);
@ -254,6 +262,7 @@ function recurrenceRule2String(recurrenceInfo, startDate, endDate, allDay) {
yearlyString = nounClass(dayString, yearlyString);
ordinalString = nounClass(dayString, ordinalString);
let ordinal = getRString(ordinalString);
let day = getRString(dayString);
yearlyString = getRString(yearlyString, [ordinal, day, month]);
ruleString = PluralForm.get(rule.interval, yearlyString)
.replace("#4", rule.interval);

Просмотреть файл

@ -345,3 +345,37 @@ yearlyOrder=%1$S %3$S %2$S
# e.g. "the First Saturday of September"
# If you don't need %3$S in your locale - please put this on the third place.
yearlyOrder2=%1$S %2$S %3$S %4$S
# LOCALIZATION NOTE (pluralForWeekdays):
# This string allows to set the use of weekdays nouns in plural form for
# languages that need them in sentences like "every Monday" or "every Sunday
# of March" etc.
# Rule strings involved by this setting are:
# - weeklyNthOn (only the first part) e.g. "every Sunday"
# - monthlyEveryOfEvery
# e.g. "every Monday of every month;every Monday every 2 months"
# - yearlyOnEveryNthOfNth
# e.g. "every Friday of March;every 2 years on every Friday of March"
# In your local write:
# "true" if sentences like those above need weekday in plural form;
# "false" if sentences like those above don't need weekday in plural form;
pluralForWeekdays=false
# LOCALIZATION NOTE (repeatDetailsDayxxxPlural):
# Edit recurrence window -> Recurrence details link on Event/Task dialog window
# Weekdays in plural form used inside sentences like "every Monday" or
# "every Sunday of May" etc. for languages that need them.
# These plurals will be used inside the following rule strings only if string
# 'pluralForWeekdays' (see above) is set to "true":
# - weeklyNthOn (only the first part) e.g. "every Sunday"
# - monthlyEveryOfEvery
# e.g. "every Monday of every month;every Monday every 2 months"
# - yearlyOnEveryNthOfNth
# e.g. "every Friday of March;every 2 years on every Friday of March"
repeatDetailsDay1Plural=Sunday
repeatDetailsDay2Plural=Monday
repeatDetailsDay3Plural=Tuesday
repeatDetailsDay4Plural=Wednesday
repeatDetailsDay5Plural=Thursday
repeatDetailsDay6Plural=Friday
repeatDetailsDay7Plural=Saturday