Skip to content

Added missing 'Saturday' string to locale-en #2490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/locale-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
'Click to enter Colorscale title': 'Click to enter Colourscale title'
},
format: {
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
months: [
'January', 'February', 'March', 'April', 'May', 'June',
Expand Down
86 changes: 86 additions & 0 deletions test/jasmine/tests/localize_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,92 @@ describe('localization', function() {
.then(done);
});

function getLabels(axLetter) {
var out = [];
var s = d3.select(gd).selectAll('.' + axLetter + 'tick');
s.each(function() { out.push(d3.select(this).text()); });
return out;
}

it('contains all short and long day and month names in the default locale', function(done) {
Plotly.newPlot(gd, [{
x: ['2000-01-01', '2000-12-01'],
y: ['2000-01-02', '2000-01-08'],
mode: 'markers'
}], {
xaxis: {dtick: 'M1', tickformat: '%b'},
yaxis: {dtick: 1000 * 3600 * 24, tickformat: '%a'}
})
.then(function() {
expect(getLabels('x')).toEqual([
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
]);
expect(getLabels('y')).toEqual([
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
]);

return Plotly.relayout(gd, {
'xaxis.tickformat': '%B',
'yaxis.tickformat': '%A'
});
})
.then(function() {
expect(getLabels('x')).toEqual([
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
]);
expect(getLabels('y')).toEqual([
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
]);
})
.catch(failTest)
.then(done);
});

it('contains correct periods, dateTime, date, and time fields in the default locale', function(done) {
Plotly.newPlot(gd, [{
x: ['2000-01-01 11:00', '2000-01-01 13:00'],
y: ['2000-01-01 23:00', '2000-01-02 01:00'],
mode: 'markers'
}], {
xaxis: {dtick: 1000 * 3600, tickformat: '%-I %p'},
yaxis: {dtick: 1000 * 3600, tickformat: '%-I %p'}
})
.then(function() {
expect(getLabels('x')).toEqual(['11 AM', '12 PM', '1 PM']);
expect(getLabels('y')).toEqual(['11 PM', '12 AM', '1 AM']);

return Plotly.relayout(gd, {
'xaxis.tickformat': '%c',
'yaxis.tickformat': '%x~%X'
});
})
.then(function() {
expect(getLabels('x')).toEqual([
'Sat Jan 1 11:00:00 2000', 'Sat Jan 1 12:00:00 2000', 'Sat Jan 1 13:00:00 2000'
]);
expect(getLabels('y')).toEqual([
// here we're using British English, so day/month/year
'01/01/2000~23:00:00', '02/01/2000~00:00:00', '02/01/2000~01:00:00'
]);

Plotly.register(require('@src/locale-en-us'));
return Plotly.redraw(gd);
})
.then(function() {
expect(getLabels('x')).toEqual([
'Sat Jan 1 11:00:00 2000', 'Sat Jan 1 12:00:00 2000', 'Sat Jan 1 13:00:00 2000'
]);
expect(getLabels('y')).toEqual([
// now with the US version
'01/01/2000~23:00:00', '01/02/2000~00:00:00', '01/02/2000~01:00:00'
]);
})
.catch(failTest)
.then(done);
});

it('uses the region first, then language (registered case)', function(done) {
plot('eg-AU')
.then(function() {
Expand Down