Localize time units on activity heatmap (#21570)
Previously, the months and days were hardcoded into English * Closes #15541 ## Screenshots ### English  ### German  ### Spanish  ### Italian  ### Portuguese This one has a bit of overflow  Signed-off-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
76e9a4f701
commit
125e3e3d66
4 changed files with 51 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
import {expect, test} from 'vitest';
|
||||
import {
|
||||
basename, extname, isObject, uniq, stripTags, joinPaths, parseIssueHref,
|
||||
prettyNumber, parseUrl,
|
||||
prettyNumber, parseUrl, translateMonth, translateDay
|
||||
} from './utils.js';
|
||||
|
||||
test('basename', () => {
|
||||
|
@ -109,3 +109,25 @@ test('parseUrl', () => {
|
|||
expect(parseUrl('https://localhost/path?search').search).toEqual('?search');
|
||||
expect(parseUrl('https://localhost/path?search#hash').hash).toEqual('#hash');
|
||||
});
|
||||
|
||||
test('translateMonth', () => {
|
||||
const originalLang = document.documentElement.lang;
|
||||
document.documentElement.lang = 'en-US';
|
||||
expect(translateMonth(0)).toEqual('Jan');
|
||||
expect(translateMonth(4)).toEqual('May');
|
||||
document.documentElement.lang = 'es-ES';
|
||||
expect(translateMonth(5)).toEqual('jun');
|
||||
expect(translateMonth(6)).toEqual('jul');
|
||||
document.documentElement.lang = originalLang;
|
||||
});
|
||||
|
||||
test('translateDay', () => {
|
||||
const originalLang = document.documentElement.lang;
|
||||
document.documentElement.lang = 'fr-FR';
|
||||
expect(translateDay(1)).toEqual('lun.');
|
||||
expect(translateDay(5)).toEqual('ven.');
|
||||
document.documentElement.lang = 'pl-PL';
|
||||
expect(translateDay(1)).toEqual('pon.');
|
||||
expect(translateDay(5)).toEqual('pt.');
|
||||
document.documentElement.lang = originalLang;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue