Skip to content
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

add persian localization #6011

Open
wants to merge 10 commits into
base: development
Choose a base branch
from
4 changes: 2 additions & 2 deletions libs/doc-pages/datepicker/src/lib/datepicker.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { defineLocale, LocaleData } from 'ngx-bootstrap/chronos';
import { BsDatepickerModule, DatepickerModule } from 'ngx-bootstrap/datepicker';

import {
arLocale, bgLocale, caLocale, csLocale, daLocale, deLocale, enGbLocale, esDoLocale, esLocale, esUsLocale, etLocale, frLocale, heLocale,
arLocale, bgLocale, caLocale, csLocale, daLocale, deLocale, enGbLocale, esDoLocale, esLocale, esUsLocale, etLocale, faLocale, frLocale, heLocale,
hiLocale, hrLocale, fiLocale, glLocale, huLocale, idLocale, itLocale, jaLocale, kaLocale, kkLocale, koLocale, ltLocale, lvLocale, mnLocale, nbLocale,
nlBeLocale, nlLocale, plLocale, ptBrLocale, ruLocale, roLocale, skLocale, slLocale, sqLocale, svLocale, thLocale, thBeLocale, trLocale, viLocale,
zhCnLocale, ukLocale
Expand All @@ -23,7 +23,7 @@ import { DEMO_COMPONENTS } from './demos/index';
export { DatepickerSectionComponent } from './datepicker-section.component';

const locales = [
arLocale, bgLocale, caLocale, csLocale, daLocale, deLocale, enGbLocale, esDoLocale, esLocale, esUsLocale, etLocale, frLocale,
arLocale, bgLocale, caLocale, csLocale, daLocale, deLocale, enGbLocale, esDoLocale, esLocale, esUsLocale, etLocale, faLocale, frLocale,
heLocale, hiLocale, hrLocale, fiLocale, glLocale, huLocale, idLocale, itLocale, jaLocale, kaLocale, kkLocale, koLocale, ltLocale, lvLocale, mnLocale,
nbLocale, nlBeLocale, nlLocale, plLocale, ptBrLocale, ruLocale, roLocale, skLocale, slLocale, sqLocale, svLocale, thLocale, thBeLocale,
trLocale, ukLocale, viLocale, zhCnLocale
Expand Down
4 changes: 2 additions & 2 deletions libs/doc-pages/datepicker/src/lib/demo-datepicker.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { defineLocale, LocaleData } from 'ngx-bootstrap/chronos';
import { BsDatepickerModule, DatepickerModule } from 'ngx-bootstrap/datepicker';

import {
arLocale, bgLocale, caLocale, csLocale, daLocale, deLocale, enGbLocale, esDoLocale, esLocale, esUsLocale, etLocale, frLocale, heLocale,
arLocale, bgLocale, caLocale, csLocale, daLocale, deLocale, enGbLocale, esDoLocale, esLocale, esUsLocale, etLocale, faLocale, frLocale, heLocale,
hiLocale, hrLocale, fiLocale, glLocale, huLocale, idLocale, itLocale, jaLocale, kaLocale, kkLocale, koLocale, ltLocale, lvLocale, mnLocale, nbLocale,
nlBeLocale, nlLocale, plLocale, ptBrLocale, ruLocale, roLocale, skLocale, slLocale, sqLocale, svLocale, thLocale, thBeLocale, trLocale, viLocale,
zhCnLocale, ukLocale
Expand All @@ -21,7 +21,7 @@ import { routes } from './demo-datepicker.routes';
import { DEMO_COMPONENTS } from './demos/index';

const locales = [
arLocale, bgLocale, caLocale, csLocale, daLocale, deLocale, enGbLocale, esDoLocale, esLocale, esUsLocale, etLocale, frLocale,
arLocale, bgLocale, caLocale, csLocale, daLocale, deLocale, enGbLocale, esDoLocale, esLocale, esUsLocale, etLocale, faLocale, frLocale,
heLocale, hiLocale, hrLocale, fiLocale, glLocale, huLocale, idLocale, itLocale, jaLocale, kaLocale, kkLocale, koLocale, ltLocale, lvLocale, mnLocale,
nbLocale, nlBeLocale, nlLocale, plLocale, ptBrLocale, ruLocale, roLocale, skLocale, slLocale, sqLocale, svLocale, thLocale, thBeLocale,
trLocale, ukLocale, viLocale, zhCnLocale
Expand Down
13 changes: 13 additions & 0 deletions scully.ngx-bootstrap-docs.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = void 0;
exports.config = {
projectRoot: "./apps/ngx-bootstrap-docs/src",
projectName: "ngx-bootstrap-docs",
outDir: './dist/static/ngx-bootstrap',
extraRoutes: ["/documentation", "/discover", "/accordion", "/alerts", "/buttons", "/carousel", "/collapse", "/datepicker", "/dropdowns", "/modals", "/pagination", "/popover", "/progressbar", "/rating", "/sortable", "/tabs", "/timepicker", "/tooltip", "/typeahead"],
routes: {},
guessParserOptions: {
excludedFiles: ['src/app/app.routing.ts'],
},
};
183 changes: 183 additions & 0 deletions src/chronos/i18n/fa.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
//! moment.js locale configuration
//! locale : Persian [fa]
//! author : mhk: https://github.com/mhkaram97
//! author : Mohammad Hossein Karami
//! author : https://github.com/mhkaram97

/** @type {?} */
var symbolMap = {
1: '١',
2: '٢',
3: '٣',
4: '٤',
5: '٥',
6: '٦',
7: '٧',
8: '٨',
9: '٩',
0: '٠'
};
/** @type {?} */
var numberMap = {
'١': '1',
'٢': '2',
'٣': '3',
'٤': '4',
'٥': '5',
'٦': '6',
'٧': '7',
'٨': '8',
'٩': '9',
'٠': '0'
};
/** @type {?} */
var pluralForm = (/**
* @param {?} num
* @return {?}
*/
function (num) {
return num === 0 ? 0 : num === 1 ? 1 : num === 2 ? 2 : num % 100 >= 3 && num % 100 <= 10 ? 3 : num % 100 >= 11 ? 4 : 5;
});
var a0 = pluralForm;
/** @type {?} */
var plurals = {
s: ['کمتر از یک ثانیه', 'یک ثانیه', ['دو ثانیه', 'دو ثانیه'], '%d ثانیه', '%d ثانیه', '%d ثانیه'],
m: ['کمتر از یک دقیقه', 'یک دقیقه', ['دو دقیقه', 'دو دقیقه'], '%d دقیقه', '%d دقیقه', '%d دقیقه'],
h: ['کمتر از یک ساعت', 'یک ساعت', ['دو ساعت', 'دو ساعت'], '%d ساعت', '%d ساعت', '%d ساعت'],
d: ['کمتر از یک روز', 'یک روز', ['دو روز', 'دو روز'], '%d روز', '%d روز', '%d روز'],
M: ['کمتر از یک ماه', 'یک ماه', ['دو ماه', 'دو ماه'], '%d ماه', '%d ماه', '%d ماه'],
y: ['کمتر از یک سال', 'یک سال', ['دو سال', 'دو سال'], '%d سال', '%d سال', '%d سال']
};
/** @type {?} */
var pluralize = (/**
* @param {?} u
* @return {?}
*/
function (u) {
return (/**
* @param {?} num
* @param {?} withoutSuffix
* @return {?}
*/
function (num, withoutSuffix) {
/** @type {?} */
var f = pluralForm(num);
/** @type {?} */
var str = plurals[u][pluralForm(num)];
if (f === 2) {
str = str[withoutSuffix ? 0 : 1];
}
return ((/** @type {?} */ (str))).replace(/%d/i, num.toString());
});
});
var a1 = pluralize;
/** @type {?} */
var months = [
'ژانویه',
'فوریه',
'مارس',
'آوریل',
'می',
'ژوئن',
'جولای',
'آگوست',
'سپتامبر',
'اکتبر',
'نوامبر',
'دسامبر'
];
/** @type {?} */
export var faLocale = {
abbr: 'fa',
months: months,
monthsShort: months,
weekdays: 'یکشنبه_دوشنبه_سه شنبه_چهارشنبه_پنج شنبه_جمعه_شنبه'.split('_'),
weekdaysShort: 'یکشنبه_دو‌شنبه_سه‌شنبه_چهار‌شنبه_پنج‌شنبه_جمعه_شنبه'.split('_'),
weekdaysMin: 'ی_د_س_چ_پ_ج_ش'.split('_'),
weekdaysParseExact: true,
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'D/\u200FM/\u200FYYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
meridiemParse: /ص|م/,
isPM: /**
* @param {?} input
* @return {?}
*/
function (input) {
return 'م' === input;
},
meridiem: /**
* @param {?} hour
* @param {?} minute
* @param {?} isLower
* @return {?}
*/
function (hour, minute, isLower) {
if (hour < 12) {
return 'ص';
}
else {
return 'م';
}
},
calendar: {
sameDay: '[امروز در ساعت] LT',
nextDay: '[فردا در ساعت] LT',
nextWeek: 'dddd [در ساعت] LT',
lastDay: '[دیروز در ساعت] LT',
lastWeek: 'dddd [در ساعت] LT',
sameElse: 'L'
},
relativeTime: {
future: 'بعد %s',
past: 'پیش %s',
s: pluralize('s'),
ss: pluralize('s'),
m: pluralize('m'),
mm: pluralize('m'),
h: pluralize('h'),
hh: pluralize('h'),
d: pluralize('d'),
dd: pluralize('d'),
M: pluralize('M'),
MM: pluralize('M'),
y: pluralize('y'),
yy: pluralize('y')
},
preparse: /**
* @param {?} str
* @return {?}
*/
function (str) {
return str.replace(/[١٢٣٤٥٦٧٨٩٠]/g, (/**
* @param {?} match
* @return {?}
*/
function (match) {
return numberMap[match];
})).replace(/،/g, ',');
},
postformat: /**
* @param {?} str
* @return {?}
*/
function (str) {
return str.replace(/\d/g, (/**
* @param {?} match
* @return {?}
*/
function (match) {
return symbolMap[match];
})).replace(/,/g, '،');
},
week: {
dow: 6, // Saturday is the first day of the week.
doy: 80 // The week that contains March 21th is the first week of the year.
}
};
export { a0, a1 };
1 change: 1 addition & 0 deletions src/chronos/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ export { trLocale } from './i18n/tr';
export { ukLocale } from './i18n/uk';
export { viLocale } from './i18n/vi';
export { zhCnLocale } from './i18n/zh-cn';
export { faLocale } from './i18n/fa';
Loading