Skip to content

Commit

Permalink
feat(ngLocale): add support for standalone months
Browse files Browse the repository at this point in the history
This is needed for languages for which the month on its own has a
different format (case) than when used as part of a date.

Closes angular#3744
Fixes angular#10247
Fixes angular#12642
  • Loading branch information
Narretz committed Sep 14, 2015
1 parent 159efdd commit 24ea91c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions i18n/spec/closureI18nExtractorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function newTestLocaleInfo() {
DATETIME_FORMATS: {
MONTH: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
'octobre', 'novembre', 'décembre'],
STANDALONEMONTH: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
'octobre', 'novembre', 'décembre'],
SHORTMONTH: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.',
'nov.', 'déc.'],
DAY: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
Expand Down Expand Up @@ -180,6 +182,8 @@ describe("extractDateTimeSymbols", function() {
DATETIME_FORMATS: {
MONTH: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
'octobre', 'novembre', 'décembre'],
STANDALONEMONTH: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',
'août', 'septembre', 'octobre', 'novembre', 'décembre'],
SHORTMONTH: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.',
'nov.', 'déc.'],
DAY: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
Expand Down
2 changes: 2 additions & 0 deletions i18n/spec/converterSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe("convertNumberData", function() {
describe("convertDatetimeData", function() {
var convert = converter.convertDatetimeData,
dataObj = { MONTHS: ['Enero', 'Pebrero'],
STANDALONEMONTHS: ['Enero', 'Pebrero'],
SHORTMONTHS: ['Ene', 'Peb'],
WEEKDAYS: ['Linggo', 'Lunes'],
SHORTWEEKDAYS: ['Lin', 'Lun'],
Expand All @@ -37,6 +38,7 @@ describe("convertDatetimeData", function() {
it('should convert empty datetime obj', function() {
var processedData = convert(dataObj);
expect(processedData.MONTH).toEqual(['Enero', 'Pebrero']);
expect(processedData.STANDALONEMONTH).toEqual(['Enero', 'Pebrero']);
expect(processedData.SHORTMONTH).toEqual(['Ene', 'Peb']);
expect(processedData.DAY).toEqual(['Linggo', 'Lunes']);
expect(processedData.SHORTDAY).toEqual(['Lin', 'Lun']);
Expand Down
1 change: 1 addition & 0 deletions i18n/src/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function convertDatetimeData(dataObj) {

datetimeFormats.MONTH = dataObj.MONTHS;
datetimeFormats.SHORTMONTH = dataObj.SHORTMONTHS;
datetimeFormats.STANDALONEMONTH = dataObj.STANDALONEMONTHS;
datetimeFormats.DAY = dataObj.WEEKDAYS;
datetimeFormats.SHORTDAY = dataObj.SHORTWEEKDAYS;
datetimeFormats.AMPMS = dataObj.AMPMS;
Expand Down

0 comments on commit 24ea91c

Please sign in to comment.