Skip to content

Commit

Permalink
feat(module:locale): support russian locale (#853)
Browse files Browse the repository at this point in the history
  • Loading branch information
zverbeta authored and vthinkxie committed Jan 6, 2018
1 parent 0384eec commit 8d65a83
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/components/calendar/nz-calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,17 @@ export class NzCalendarComponent implements OnInit {
this._monthUnit = moment.duration(4, 'week').humanize().split(' ')[ 1 ][ 0 ].toUpperCase() + moment.duration(4, 'week').humanize().split(' ')[ 1 ].slice(1, moment.duration(4, 'week').humanize().split(' ')[ 1 ].length);
} catch (e) { }
}

if (this._locale === 'ru-RU') {
try {
const monthText = moment.duration(12, 'month').humanize().split(' ')[ 0 ];
const weekText = moment.duration(4, 'week').humanize().split(' ')[ 0 ];

this._yearUnit = monthText.charAt(0).toUpperCase() + monthText.slice(1);
this._monthUnit = weekText.charAt(0).toUpperCase() + weekText.slice(1);
} catch (e) { }
}

this._listOfYearName = this._generateYears(this._showYear);
this._listOfWeekName = moment.weekdaysMin();
this._listOfMonthName = moment.monthsShort();
Expand Down
1 change: 1 addition & 0 deletions src/components/locale/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './zh-CN';
export * from './en-US';
export * from './tr-TR';
export * from './zh-TW';
export * from './ru-RU';
63 changes: 63 additions & 0 deletions src/components/locale/locales/ru-RU.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { NzLocale } from '../nz-locale.class';

export const ruRU: NzLocale = {
locale: 'ru-RU',

Pagination: {
itemsPerPage: '%num% / страниц',
jumpTo: 'Перейти',
page: '',
forwardPage: '%num% страниц вперед',
backwardPage: '%num% страниц назад',
prevPage: 'Предыдущая страница',
nextPage: 'Следующая страница',
firstPage: 'Первая страница',
lastPage: 'Последняя страница: %page%',
totalItems: 'Всего %total%',
},

DateTime: {
clear: 'Очистить',
chooseMonth: 'Выберите месяц',
chooseYear: 'Выберите год',
chooseDecade: 'Выберите десятилетие',
nYear: '%num%',
nMonth: '%num%',
nDay: '%num%',
prevYear: 'Предыдущий год',
nextYear: 'Следующий год',
prevMonth: 'Предыдущий месяц',
nextMonth: 'Следующий месяц',
prevDecade: 'Предыдущее десятилетие',
nextDecade: 'Следующее десятилетие',
chooseTime: 'Выберите время',
chooseDate: 'Выберите дату',
chooseTimePlease: 'Выберите время',
chooseDatePlease: 'Выберите дату',
thisMoment: 'Сейчас',
today: 'Сегодня',
ok: 'Ок',
},

Modal: {
okText: 'Ок',
cancelText: 'Отмена',
understood: 'Ок',
},

Table: {
emptyText: 'Нет данных',
},

Select: {
notFoundContent: 'Ничего не найдено',
},

Transfer: {
titles: ',',
notFoundContent: 'Нет данных',
searchPlaceholder: 'Поиск',
itemUnit: 'элемент',
itemsUnit: 'элементов',
}
};
7 changes: 6 additions & 1 deletion src/showcase/nz-demo-locale/nz-demo-locale-all.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { zhCN, enUS, trTR, zhTW, NzModalService, NzLocaleService } from '../../../index.showcase';
import { zhCN, ruRU, enUS, trTR, zhTW, NzModalService, NzLocaleService } from '../../../index.showcase';

@Component({
selector: 'nz-demo-locale-all',
Expand All @@ -12,6 +12,7 @@ import { zhCN, enUS, trTR, zhTW, NzModalService, NzLocaleService } from '../../.
<label nz-radio-button [nzValue]="zhTW"><span>繁体</span></label>
<label nz-radio-button [nzValue]="trTR"><span>Turkish</span></label>
<label nz-radio-button [nzValue]="enUS"><span>English</span></label>
<label nz-radio-button [nzValue]="ruRU"><span>Russian</span></label>
</nz-radio-group>
</div>
Expand All @@ -28,6 +29,9 @@ import { zhCN, enUS, trTR, zhTW, NzModalService, NzLocaleService } from '../../.
<ng-container *ngIf="locale === zhTW">
<ng-container *ngTemplateOutlet="tplLocale"></ng-container>
</ng-container>
<ng-container *ngIf="locale === ruRU">
<ng-container *ngTemplateOutlet="tplLocale"></ng-container>
</ng-container>
<ng-template #tplLocale>
<nz-demo-locale-all-page></nz-demo-locale-all-page>
</ng-template>
Expand All @@ -39,6 +43,7 @@ export class NzDemoLocaleAllComponent implements OnInit {
enUS = enUS;
zhTW = zhTW;
trTR = trTR;
ruRU = ruRU;

_locale;
get locale() {
Expand Down
1 change: 1 addition & 0 deletions src/showcase/nz-intro-i18n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ export class AppModule { }
| 繁体中文 | zh-TW |
| 美式英语 | en-US |
| 土耳其语 | tr-TR |
| 俄语 | ru-RU |

具体的使用方法和新语言包贡献方式请参考 [Locale](#/other/locale) 文档。

0 comments on commit 8d65a83

Please sign in to comment.