Permalink
Browse files

Merge pull request #7540 from dscravag/nightly2

Nightly 2013-01-11
  • Loading branch information...
dscravag committed Jan 11, 2013
2 parents 9d4983b + de643c2 commit 50034cf938ff160bfb9525b0653ba9f61013831e
Showing with 2,340 additions and 943 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 apps/calendar/index.html
  3. +37 −28 apps/calendar/js/app.js
  4. +43 −3 apps/calendar/js/calc.js
  5. +1 −1 apps/calendar/js/templates/week.js
  6. +20 −2 apps/calendar/js/views/month_child.js
  7. +3 −4 apps/calendar/js/views/months_day.js
  8. +6 −6 apps/calendar/js/views/time_header.js
  9. +9 −0 apps/calendar/locales/calendar.en-US.properties
  10. +1 −1 apps/calendar/locales/calendar.fr.properties
  11. +20 −5 apps/calendar/test/unit/app_test.js
  12. +103 −0 apps/calendar/test/unit/calc_test.js
  13. +1 −1 apps/calendar/test/unit/views/months_day_test.js
  14. +17 −26 apps/camera/js/camera.js
  15. +1 −1 apps/communications/contacts/config.json
  16. +24 −6 apps/communications/contacts/js/contacts_details.js
  17. +4 −0 apps/communications/contacts/js/contacts_form.js
  18. +14 −0 apps/communications/contacts/js/search.js
  19. +2 −2 apps/communications/dialer/js/dialer.js
  20. +2 −0 apps/communications/dialer/js/handled_call.js
  21. +71 −47 apps/communications/dialer/js/keypad.js
  22. +1 −2 apps/communications/dialer/js/oncall.js
  23. +1 −1 apps/communications/dialer/js/utils.js
  24. +21 −8 apps/communications/dialer/style/commslog.css
  25. +1 −1 apps/communications/dialer/test/unit/mock_keypad.js
  26. +10 −10 apps/communications/ftu/index.html
  27. +3 −3 apps/communications/ftu/locales/ftu.en-US.properties
  28. +38 −4 apps/costcontrol/fte.html
  29. +2 −8 apps/costcontrol/js/app.js
  30. +52 −7 apps/costcontrol/js/fte.js
  31. +29 −11 apps/costcontrol/js/message_handler.js
  32. +9 −9 apps/costcontrol/js/utils/debug.js
  33. +1 −0 apps/costcontrol/js/views/telephony.js
  34. +41 −3 apps/costcontrol/js/widget.js
  35. +14 −0 apps/costcontrol/locales/costcontrol.en-US.properties
  36. BIN apps/costcontrol/style/images/widget/sim/authed-sim.png
  37. BIN apps/costcontrol/style/images/widget/sim/no-sim.png
  38. BIN apps/costcontrol/style/images/widget/sim/nonauthed-sim.png
  39. +22 −5 apps/costcontrol/style/views/firsttime.css
  40. +32 −0 apps/costcontrol/style/widget.css
  41. +8 −0 apps/costcontrol/widget.html
  42. +4 −4 apps/email/index.html
  43. +7 −1 apps/email/js/compose-cards.js
  44. +34 −20 apps/email/js/mail-app.js
  45. +6 −0 apps/email/manifest.webapp
  46. +2 −0 apps/email/style/message-cards.css
  47. +1 −1 apps/gallery/manifest.webapp
  48. +32 −49 apps/homescreen/everything.me/config/config.js
  49. +49 −0 apps/homescreen/everything.me/config/shortcuts.js
  50. +11 −8 apps/homescreen/everything.me/css/common.css
  51. +189 −109 apps/homescreen/everything.me/js/Brain.js
  52. +2 −2 apps/homescreen/everything.me/js/Core.js
  53. +81 −28 apps/homescreen/everything.me/js/api/DoATAPI.js
  54. +18 −14 apps/homescreen/everything.me/js/api/apiv2.js
  55. +6 −6 apps/homescreen/everything.me/js/etmmanager.js
  56. +1 −0 apps/homescreen/everything.me/js/everything.me.js
  57. +19 −2 apps/homescreen/everything.me/js/helpers/Utils.js
  58. +10 −2 apps/homescreen/everything.me/js/plugins/Analytics.js
  59. +23 −3 apps/homescreen/everything.me/modules/Apps/Apps.css
  60. +4 −0 apps/homescreen/everything.me/modules/Apps/Apps.js
  61. +2 −5 apps/homescreen/everything.me/modules/ConnectionMessage/ConnectionMessage.css
  62. +11 −3 apps/homescreen/everything.me/modules/ConnectionMessage/ConnectionMessage.js
  63. +25 −22 apps/homescreen/everything.me/modules/Searchbar/Searchbar.css
  64. +9 −0 apps/homescreen/everything.me/modules/Searchbar/Searchbar.js
  65. +0 −5 apps/homescreen/everything.me/modules/Shortcuts/Shortcuts.css
  66. +22 −16 apps/homescreen/everything.me/modules/Shortcuts/Shortcuts.js
  67. +10 −10 apps/homescreen/everything.me/modules/ShortcutsCustomize/ShortcutsCustomize.css
  68. +22 −14 apps/homescreen/everything.me/modules/ShortcutsCustomize/ShortcutsCustomize.js
  69. +33 −6 apps/homescreen/everything.me/modules/SmartFolder/SmartFolder.css
  70. +34 −9 apps/homescreen/everything.me/modules/SmartFolder/SmartFolder.js
  71. +1 −0 apps/homescreen/index.html
  72. +37 −0 apps/homescreen/locales/homescreen.en-US.properties
  73. +8 −0 apps/homescreen/style/app_tapped_filter.svg
  74. +4 −0 apps/homescreen/style/grid.css
  75. +80 −51 apps/settings/index.html
  76. +4 −1 apps/settings/js/about.js
  77. +7 −1 apps/settings/js/onpair.js
  78. +72 −36 apps/settings/js/settings.js
  79. +1 −0 apps/settings/locales/settings.en-US.properties
  80. +1 −1 apps/settings/style/icons.css
  81. +49 −11 apps/settings/style/lists.css
  82. +47 −23 apps/settings/style/settings.css
  83. +14 −2 apps/settings/test/unit/settings_test.js
  84. +12 −3 apps/sms/js/sms.js
  85. +6 −3 apps/sms/js/utils.js
  86. +62 −2 apps/sms/style/sms.css
  87. +8 −0 apps/system/index.html
  88. +1 −0 apps/system/js/app_install_manager.js
  89. +8 −4 apps/system/js/attention_screen.js
  90. +12 −0 apps/system/js/lockscreen.js
  91. +12 −0 apps/system/js/sim_lock.js
  92. +33 −9 apps/system/js/simcard_dialog.js
  93. +2 −1 apps/system/js/sound_manager.js
  94. +2 −1 apps/system/js/trusted_ui.js
  95. +34 −16 apps/system/js/updatable.js
  96. +24 −24 apps/system/js/update_manager.js
  97. +5 −0 apps/system/locales/system.en-US.properties
  98. +2 −11 apps/system/style/lockscreen/lockscreen.css
  99. +1 −0 apps/system/style/notifications/notifications.css
  100. +10 −0 apps/system/style/zindex.css
  101. +31 −12 apps/system/test/unit/app_install_manager_test.js
  102. +3 −0 apps/system/test/unit/mock_app.js
  103. +7 −0 apps/system/test/unit/mock_updatable.js
  104. +6 −0 apps/system/test/unit/mock_update_manager.js
  105. +116 −57 apps/system/test/unit/updatable_test.js
  106. +44 −21 apps/system/test/unit/update_manager_test.js
  107. +1 −5 apps/video/index.html
  108. +20 −27 apps/video/js/video.js
  109. +1 −0 build/applications-data.js
  110. +54 −1 build/ua-override-prefs.js
  111. +2 −1 external-apps/maps/metadata.json
  112. +46 −0 locales/languages_all.json
  113. +5 −0 locales/languages_basecamp.json
  114. +8 −0 locales/languages_dev.json
  115. +2 −0 shared/locales/date/date.en-US.properties
  116. +3 −0 shared/locales/date/date.fr.properties
  117. +1 −1 shared/style/edit_mode/index.html
  118. +12 −3 shared/style/status.css
  119. +1 −1 test_apps/uitest/index.html
  120. +84 −68 test_apps/uitest/js/identity.js
  121. +1 −1 test_apps/uitest/tests/identity.html
View
@@ -19,6 +19,7 @@ manifest.appcache
/apps/*/test/unit/_sandbox.html
/apps/*/test/unit/_proxy.html
/apps/*/shared
+/apps/settings/resources/support.json
/test_apps/*/test/unit/_sandbox.html
/test_apps/*/test/unit/_proxy.html
/showcase_apps/*/test/unit/_sandbox.html
View
@@ -390,7 +390,7 @@ <h1 data-l10n-id="account-header">Account</h1>
<form role="dialog" data-type="confirm" id="remove-account-dialog">
<section>
- <h1 data-l10n-id="remove-account-dialog">>Remove Account</h1>
+ <h1 data-l10n-id="remove-account-dialog">Remove Account</h1>
<p data-l10n-id="remove-account-dialog-details">
Removing this account will also remove your local copy of associated calendars and events.
</p>
View
@@ -77,6 +77,40 @@ Calendar.App = (function(window) {
}
};
+ var DateL10n = {
+ /**
+ * Localizes all elements with data-l10n-date-format.
+ */
+ localizeElements: function(parent) {
+ var elements = document.querySelectorAll(
+ '[data-l10n-date-format]'
+ );
+
+ var len = elements.length;
+ var i = 0;
+
+ for (; i < len; i++) {
+ DateL10n.localizeElement(elements[i]);
+ }
+ },
+
+ /**
+ * Localize a single element expected to have data-l10n-date-format.
+ */
+ localizeElement: function(element) {
+ var date = element.dataset.date;
+ var formatKey = element.dataset.l10nDateFormat;
+ var format = navigator.mozL10n.get(formatKey);
+
+ if (date) {
+ element.textContent = Calendar.App.dateFormat.localeFormat(
+ new Date(date),
+ format
+ );
+ }
+ }
+ };
+
/**
* Focal point for state management
* within calendar application.
@@ -87,6 +121,8 @@ Calendar.App = (function(window) {
var App = {
PendingManager: PendingManager,
+ DateL10n: DateL10n,
+
//XXX: always assumes that app is never lazy loaded
startingURL: window.location.href,
@@ -220,34 +256,7 @@ Calendar.App = (function(window) {
*
*/
observeDateLocalization: function() {
- function localize() {
- var elements = document.querySelectorAll(
- '[data-l10n-date-format]'
- );
-
- var len = elements.length;
- var i = 0;
-
- var date;
- var format;
- var el;
-
- for (; i < len; i++) {
- el = elements[i];
-
- date = el.dataset.date;
- format = el.dataset.l10nDateFormat;
-
- if (date) {
- el.textContent = Calendar.App.dateFormat.localeFormat(
- new Date(date),
- format
- );
- }
- }
- }
-
- window.addEventListener('localized', localize);
+ window.addEventListener('localized', DateL10n.localizeElements);
},
/**
View
@@ -8,6 +8,8 @@ Calendar.Calc = (function() {
_hourDate: new Date(),
+ startsOnMonday: false,
+
FLOATING: 'floating',
ALLDAY: 'allday',
@@ -77,6 +79,24 @@ Calendar.Calc = (function() {
return 7;
},
+ /**
+ * Calculates day of week when starting day is Monday.
+ */
+ dayOfWeekFromMonday: function(numeric) {
+ var day = numeric - 1;
+ if (day < 0)
+ return 6;
+
+ return day;
+ },
+
+ /**
+ * Calculates day of week when starting day is Sunday.
+ */
+ dayOfWeekFromSunday: function(numeric) {
+ return numeric;
+ },
+
/**
* Checks is given date is today.
*
@@ -403,10 +423,20 @@ Calendar.Calc = (function() {
/**
* Returns localized day of week.
+ *
+ * @param {Date|Number} date numeric or date object.
*/
dayOfWeek: function(date) {
- // XXX: we need to localize this further.
- return date.getDay();
+ var number = date;
+
+ if (typeof(date) !== 'number') {
+ number = date.getDay();
+ }
+
+ if (Calc.startsOnMonday) {
+ return this.dayOfWeekFromMonday(number);
+ }
+ return this.dayOfWeekFromSunday(number);
},
/**
@@ -417,7 +447,7 @@ Calendar.Calc = (function() {
*/
getWeekStartDate: function(date) {
var currentDay = Calc.dayOfWeek(date);
- var startDay = date.getDate() - currentDay;
+ var startDay = (date.getDate() - currentDay);
return Calc.createDay(date, startDay);
},
@@ -578,6 +608,16 @@ Calendar.Calc = (function() {
};
+ window.addEventListener('localized', function changeStartDay() {
+ var startDay = navigator.mozL10n.get('weekStartsOnMonday');
+
+ if (startDay && parseInt(startDay, 10)) {
+ Calc.startsOnMonday = true;
+ } else {
+ Calc.startsOnMonday = false;
+ }
+ });
+
return Calc;
}());
@@ -29,7 +29,7 @@
event: function() {
return '<li class="event" data-id="' + this.h('busytimeId') + '">' +
- '<div class="container calend +ar-id-' + this.h('calendarId') + ' ' +
+ '<div class="container calendar-id-' + this.h('calendarId') + ' ' +
'calendar-display calendar-color">' +
this.h('title') +
'</div>' +
@@ -2,6 +2,11 @@
var template = Calendar.Templates.Month;
var Calc = Calendar.Calc;
+ // horrible hack to clear cache when we re-localize
+ window.addEventListener('localized', function clearHeaderCache() {
+ Child._dayHeaders = null;
+ });
+
function Child() {
Calendar.View.apply(this, arguments);
@@ -192,9 +197,22 @@
var html = '';
for (; i < days; i++) {
- name = navigator.mozL10n.get('weekday-' + i + '-short');
+ var day = i;
+ // localization updates this value
+ if (Calendar.Calc.startsOnMonday) {
+ // 0 is monday which is 1 in l10n (based on js engine's getDay)
+ day += 1;
+
+ // 6th day of the week which Sunday (and 0 in js engine).
+ if (day === 7) {
+ day = 0;
+ }
+ }
+ var l10n = 'weekday-' + day + '-short';
+
+ name = navigator.mozL10n.get(l10n);
html += template.weekDaysHeaderDay.render({
- day: String(i),
+ day: String(day),
dayName: name
});
}
@@ -41,9 +41,8 @@ Calendar.ns('Views').MonthsDay = (function() {
_updateHeader: function() {
var header = this.header;
- var template = navigator.mozL10n.get(
- 'agenda-date-format'
- );
+ var formatName = 'agenda-date-format';
+ var template = navigator.mozL10n.get(formatName);
// maybe we should localize this output ?
var format = this.app.dateFormat.localeFormat(
@@ -53,7 +52,7 @@ Calendar.ns('Views').MonthsDay = (function() {
header.textContent = format;
header.dataset.date = this.date.toString();
- header.dataset.l10nDateFormat = template;
+ header.dataset.l10nDateFormat = formatName;
},
handleEvent: function(e) {
@@ -28,12 +28,12 @@ Calendar.ns('Views').TimeHeader = (function() {
},
scales: {
- month: '%B %Y',
- day: '%A %B %e',
+ month: 'month-view-header-format',
+ day: 'day-view-header-format',
// when week starts in one month and ends
// in another, we need both of them
// in the header
- singleMonth: '%B '
+ singleMonth: 'single-month-view-header-format'
},
handleEvent: function(e) {
@@ -112,19 +112,19 @@ Calendar.ns('Views').TimeHeader = (function() {
if (firstWeekday.getMonth() !== lastWeekday.getMonth()) {
scale = this.app.dateFormat.localeFormat(
firstWeekday,
- this.scales.singleMonth
+ navigator.mozL10n.get(this.scales.singleMonth)
);
}
return scale + this.app.dateFormat.localeFormat(
lastWeekday,
- this.scales.month
+ navigator.mozL10n.get(this.scales.month)
);
}
return this.app.dateFormat.localeFormat(
this.controller.position,
- this.scales[type] || this.scales.month
+ navigator.mozL10n.get(this.scales[type] || this.scales.month)
);
},
@@ -86,6 +86,15 @@ agenda-date-format=%A %e %B %Y
hour-format=%I %p
hour-allday=All Day
+# Default header used in month view / week view
+month-view-header-format=%B %Y
+
+# In week view when displaying multiple months (weeks that span months).
+single-month-view-header-format=%B
+
+# Header format used for in the day view.
+day-view-header-format=%A %B %e
+
#errors
error-start-after-end=End date must come after start date
error-unauthenticated=Wrong login and/or password
@@ -76,7 +76,7 @@ sync-frequency-hourly.textContent=Chaque heure
alarm-starting={{title}} a débuté à {{distance}}
alarm-started={{title}} débutera dans {{distance}}
-# 24 vs 12 see http://www.cplusplus.com/reference/clibrary/ctime/strftime/
+# Date formatting details (http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html)
hour-format=%Hh
#errors
@@ -49,6 +49,19 @@ suite('app', function() {
var expected;
var fmt;
var id = 0;
+ var realL10n;
+ var l10nMap;
+
+ suiteSetup(function() {
+ realL10n = navigator.mozL10n.get;
+ navigator.mozL10n.get = function(name) {
+ return l10nMap[name] || '';
+ };
+ });
+
+ suiteTeardown(function() {
+ navigator.mozL10n.get = realL10n;
+ });
function dateElement(date, format) {
var el = document.createElement('span');
@@ -61,24 +74,26 @@ suite('app', function() {
return el;
}
- function addExpect(date, format) {
+ function addExpect(date, formatName, formatValue) {
var elId = 'dateId-' + (++id);
- dateElement(date, format).id = elId;
+ l10nMap[formatName] = formatValue;
+ dateElement(date, formatName).id = elId;
expected.push(
- [elId, fmt.localeFormat(date, format)]
+ [elId, fmt.localeFormat(date, formatValue)]
);
}
setup(function() {
+ l10nMap = {};
fmt = Calendar.App.dateFormat = navigator.mozL10n.DateTimeFormat();
expected = [];
var formatXDate = new Date(2012, 1, 1);
var formatCDate = new Date(2012, 1, 1, 7, 2, 9);
- addExpect(formatCDate, '%x');
- addExpect(formatCDate, '%c');
+ addExpect(formatCDate, 'myl10nKey', '%x');
+ addExpect(formatCDate, 'otherl10nKey', '%c');
subject.observeDateLocalization();
window.dispatchEvent(new Event('localized'));
Oops, something went wrong.

0 comments on commit 50034cf

Please sign in to comment.