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

fix: locale: add support for hi locale #602

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
9 changes: 5 additions & 4 deletions src/components/ConfigProvider/ConfigProvider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import frBE from '../Locale/fr_BE'; // Français (Belgium) TODO: dayjs has no fr
import frCA from '../Locale/fr_CA'; // Français (Canada)
import frFR from '../Locale/fr_FR'; // Français
import heIL from '../Locale/he_IL'; // עברית
// import hiHI from '../Locale/hi_HI'; // हिंदी TODO: Add Hindi locale
import hiIN from '../Locale/hi_IN'; // हिंदी
import hrHR from '../Locale/hr_HR'; // Hrvatski
import htHT from '../Locale/ht_HT'; // Haitian
import huHU from '../Locale/hu_HU'; // Magyar
Expand Down Expand Up @@ -94,7 +94,7 @@ import 'dayjs/locale/fi';
import 'dayjs/locale/fr'; // Use fr for fr-BE too
import 'dayjs/locale/fr-ca';
import 'dayjs/locale/he';
// import 'dayjs/locale/hi'; uncomment when Hindi locale is added
import 'dayjs/locale/hi';
import 'dayjs/locale/hr';
import 'dayjs/locale/ht';
import 'dayjs/locale/hu';
Expand Down Expand Up @@ -639,7 +639,7 @@ const localeValues: string[] = [
'fr_CA',
'fr_FR',
'he_IL',
// 'hi_HI',
'hi_IN',
'hr_HR',
'ht_HT',
'hu_HU',
Expand Down Expand Up @@ -703,7 +703,7 @@ const Locale_Story: ComponentStory<typeof ConfigProvider> = (args) => {
fr_CA: frCA,
fr_FR: frFR,
he_IL: heIL,
// 'hi_HI': hiHI,
hi_IN: hiIN,
hr_HR: hrHR,
ht_HT: htHT,
hu_HU: huHU,
Expand Down Expand Up @@ -742,6 +742,7 @@ const Locale_Story: ComponentStory<typeof ConfigProvider> = (args) => {
fr_CA: 'fr-ca',
fr_FR: 'fr',
he_IL: 'he',
hi_IN: 'hi',
hr_HR: 'hr',
ht_HT: 'ht',
hu_HU: 'hu',
Expand Down
24 changes: 24 additions & 0 deletions src/components/DateTimePicker/DatePicker/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import CalendarLocale from '../../Internal/Locale/hi_IN';
import TimePickerLocale from '../../TimePicker/Locale/hi_IN';
import type { PickerLocale } from '../Generate/Generate.types';

const locale: PickerLocale = {
lang: {
placeholder: 'दिनांक का चयन करें',
yearPlaceholder: 'वर्ष का चयन करें',
quarterPlaceholder: 'तिमाही का चयन करें',
monthPlaceholder: 'महीने का चयन करें',
weekPlaceholder: 'सप्ताह का चयन करें',
rangePlaceholder: ['प्रारंभ दिनांक', 'समाप्ति दिनांक'],
rangeYearPlaceholder: ['वर्ष प्रारंभ करें', 'वर्ष के अंत में'],
rangeQuarterPlaceholder: ['प्रारंभ तिमाही', 'अंत तिमाही'],
rangeMonthPlaceholder: ['महीना शुरू करें', 'अंत माह'],
rangeWeekPlaceholder: ['सप्ताह की शुरुआत', 'सप्ताह के अंत में'],
...CalendarLocale,
},
timePickerLocale: {
...TimePickerLocale,
},
};

export default locale;
1 change: 1 addition & 0 deletions src/components/DateTimePicker/Internal/Generate/dayjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const localeMap: IlocaleMapObject = {
fr_CA: 'fr-ca', // Français (Canada)
fr_FR: 'fr', // Français
he_IL: 'he', // עברית
hi_IN: 'hi', // हिंदी
hr_HR: 'hr', // Hrvatski
ht_HT: 'ht', // Haitian
hu_HU: 'hu', // Magyar
Expand Down
32 changes: 32 additions & 0 deletions src/components/DateTimePicker/Internal/Locale/hi_IN.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { Locale } from '../OcPicker.types';

const locale: Locale = {
locale: 'hi_IN',
backToToday: 'आज पर लौटें',
clear: 'स्पष्ट',
dateFormat: 'D/M/YYYY',
dateSelect: 'दिनांक का चयन करें',
dateTimeFormat: 'D/M/YYYY HH:mm:ss',
dayFormat: 'D',
decadeSelect: 'एक दशक चुनें',
month: 'महीना',
monthBeforeYear: true,
monthSelect: 'एक महीना चुनें',
nextCentury: 'अगली सदी',
nextDecade: 'अगले दशक',
nextMonth: 'अगले दशक (PageDown)',
nextYear: 'अगले साल (Control + right)',
now: 'अब',
ok: 'ठीक है',
previousCentury: 'पिछली सदी',
previousDecade: 'पिछले दशक',
previousMonth: 'पिछले महीने (PageUp)',
previousYear: 'पिछले साल (Control + left)',
timeSelect: 'समय का चयन करें',
today: 'आज',
year: 'साल',
yearFormat: 'YYYY',
yearSelect: 'एक वर्ष चुनें',
};

export default locale;
7 changes: 7 additions & 0 deletions src/components/DateTimePicker/TimePicker/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { TimePickerLocale } from '../TimePicker.types';

const locale: TimePickerLocale = {
placeholder: 'समय का चयन करें',
};

export default locale;
12 changes: 12 additions & 0 deletions src/components/Dialog/BaseDialog/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { DialogLocale } from '../BaseDialog.types';

const locale: DialogLocale = {
lang: {
locale: 'hi_IN',
cancelText: 'रद्द करना',
closeButtonAriaLabelText: 'बंद करना',
okText: 'ठीक है',
},
};

export default locale;
10 changes: 10 additions & 0 deletions src/components/InfoBar/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { InfoBarLocale } from '../InfoBar.types';

const locale: InfoBarLocale = {
lang: {
locale: 'hi_IN',
closeButtonAriaLabelText: 'बंद करना',
},
};

export default locale;
81 changes: 81 additions & 0 deletions src/components/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* eslint-disable no-template-curly-in-string */
import type { Locale } from '../LocaleProvider';
import DatePicker from '../DateTimePicker/DatePicker/Locale/hi_IN';
import Dialog from '../Dialog/BaseDialog/Locale/hi_IN';
import InfoBar from '../InfoBar/Locale/hi_IN';
import Pagination from '../Pagination/Locale/hi_IN';
import Panel from '../Panel/Locale/hi_IN';
import Stepper from '../Stepper/Locale/hi_IN';
import Table from '../Table/Locale/hi_IN';
import TimePicker from '../DateTimePicker/TimePicker/Locale/hi_IN';
import Upload from '../Upload/Locale/hi_IN';

const typeTemplate = '${label} कोई मान्य ${type} नहीं है';

const localeValues: Locale = {
locale: 'hi',
global: {
placeholder: 'चुनना',
},
DatePicker,
Dialog,
Form: {
optional: '(वैकल्पिक)',
defaultValidateMessages: {
default: '${label} के लिए फ़ील्ड सत्यापन त्रुटि',
required: '${label} आवश्यक है',
enum: '${label} [${enum}] में से एक होना चाहिए',
whitespace: '${label} एक रिक्त वर्ण नहीं हो सकता',
date: {
format: '${label} दिनांक स्वरूप अमान्य है',
parse: '${label} को दिनांक में कनवर्ट नहीं किया जा सकता',
invalid: '${label} एक अमान्य दिनांक है',
},
types: {
string: typeTemplate,
method: typeTemplate,
array: typeTemplate,
object: typeTemplate,
number: typeTemplate,
date: typeTemplate,
boolean: typeTemplate,
integer: typeTemplate,
float: typeTemplate,
regexp: typeTemplate,
email: typeTemplate,
url: typeTemplate,
hex: typeTemplate,
},
string: {
len: '${label} ${len} वर्णों का होना चाहिए',
min: '${label} कम से कम ${min} वर्णों का होना चाहिए',
max: '${label} ${max} वर्णों तक होना चाहिए',
range: '${label} ${min}-${max} वर्णों के बीच होना चाहिए',
},
number: {
len: '${label} ${len} के बराबर होना चाहिए',
min: '${label} न्यूनतम ${min} होना चाहिए',
max: '${label} अधिकतम ${max} होना चाहिए',
range: '${label} ${min}-${max} के बीच होना चाहिए',
},
array: {
len: '${len} ${label} होना चाहिए',
min: 'कम से कम ${min} ${label}',
max: 'अधिकतम ${max} ${label}',
range: '${label} की मात्रा ${min}-${max} के बीच होनी चाहिए',
},
pattern: {
mismatch: '${label} पैटर्न ${pattern} से मेल नहीं खाता है',
},
},
},
InfoBar,
Pagination,
Panel,
Stepper,
Table,
TimePicker,
Upload,
};

export default localeValues;
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ LoadedCheerio {
}
`;

exports[`Locale Provider should display the text as hi 1`] = `
LoadedCheerio {
"length": 0,
"options": Object {
"decodeEntities": true,
"xml": false,
},
}
`;

exports[`Locale Provider should display the text as hr 1`] = `
LoadedCheerio {
"length": 0,
Expand Down
2 changes: 2 additions & 0 deletions src/components/LocaleProvider/Tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import frBE from '../fr_BE';
import frCA from '../fr_CA';
import frFR from '../fr_FR';
import heIL from '../he_IL';
import hiIN from '../hi_IN';
import hrHR from '../hr_HR';
import htHT from '../ht_HT';
import huHU from '../hu_HU';
Expand Down Expand Up @@ -66,6 +67,7 @@ const locales = [
frCA,
frFR,
heIL,
hiIN,
hrHR,
htHT,
huHU,
Expand Down
3 changes: 3 additions & 0 deletions src/components/LocaleProvider/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import locale from '../Locale/hi_IN';

export default locale;
18 changes: 18 additions & 0 deletions src/components/Pagination/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { PaginationLocale } from '../Pagination.types';

const locale: PaginationLocale = {
lang: {
locale: 'hi_IN',
goToText: 'यहाँ जाओ',
nextIconButtonAriaLabel: 'अगला',
pagerText: 'का',
pageSizeButtonAriaLabel: 'चयनित पृष्ठ का आकार',
pageSizeText: 'पृष्ठ',
previousIconButtonAriaLabel: 'पिछला',
quickNextIconButtonAriaLabel: 'अगले 5',
quickPreviousIconButtonAriaLabel: 'पिछले 5',
totalText: 'कुल',
},
};

export default locale;
10 changes: 10 additions & 0 deletions src/components/Panel/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { PanelLocale } from '../Panel.types';

const locale: PanelLocale = {
lang: {
locale: 'hi_IN',
closeButtonAriaLabelText: 'बंद करना',
},
};

export default locale;
15 changes: 15 additions & 0 deletions src/components/Stepper/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { StepperLocale } from '../Stepper.types';

const locale: StepperLocale = {
lang: {
locale: 'hi_IN',
completeAriaLabelText: 'पूरा',
nodeAriaLabelText: 'गांठ',
scrollDownAriaLabelText: 'नीचे स्क्रॉल करें',
scrollLeftAriaLabelText: 'बाईं ओर स्क्रॉल करें',
scrollRightAriaLabelText: 'दाईं ओर स्क्रॉल करें',
scrollUpAriaLabelText: 'ऊपर स्क्रॉल करें',
},
};

export default locale;
25 changes: 25 additions & 0 deletions src/components/Table/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { TableLocale } from '../Table.types';

const locale: TableLocale = {
lang: {
locale: 'hi_IN',
filterConfirmText: 'ठीक है',
filterResetText: 'रीसेट',
filterEmptyText: 'कोई फ़िल्टर नहीं',
filterCheckallText: 'सभी आइटम्स का चयन करें',
filterSearchPlaceholderText: 'फ़िल्टर में खोजें',
emptyText: 'कोई डेटा नहीं मिला',
selectInvertText: 'इनवर्ट वर्तमान पृष्ठ',
selectNoneText: 'सभी डेटा साफ़ करें',
selectionAllText: 'सभी डेटा का चयन करें',
expandText: 'विस्तृत पंक्ति',
collapseText: 'पतन विवाद',
triggerDescText: 'अवरोही क्रमबद्ध करने के लिए क्लिक करें',
triggerAscText: 'आरोही क्रमबद्ध करने के लिए क्लिक करें',
cancelSortText: 'सॉर्टिंग रद्द करने के लिए क्लिक करें',
scrollLeftAriaLabelText: 'बाईं ओर स्क्रॉल करें',
scrollRightAriaLabelText: 'दाईं ओर स्क्रॉल करें',
},
};

export default locale;
28 changes: 28 additions & 0 deletions src/components/Upload/Locale/hi_IN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { UploadLocale } from '../Upload.types';

const locale: UploadLocale = {
lang: {
locale: 'hi_IN',
acceptedFileTypesText: '(doc, docx, pdf या txt)',
downloadFileText: 'फ़ाइल डाउनलोड करें',
dragAndDropFileText: 'फ़ाइल खींचें और छोड़ें',
dragAndDropMultipleFilesText: 'फ़ाइलें खींचें और छोड़ें',
modalCancelText: 'रद्द करना',
modalCloseButtonAriaLabelText: 'बंद करना',
modalOkText: 'ठीक है',
modalTitleText: 'छवि संपादित करें',
previewFileText: 'फ़ाइल का पूर्वावलोकन करें',
removeFileText: 'फ़ाइल निकालें',
replaceFileText: 'बदलें',
rotateLeftButtonAriaLabelText: 'बाएँ घुमाएं',
rotateRightButtonAriaLabelText: 'दाईं ओर घुमाएं',
selectFileText: 'फ़ाइल का चयन करें',
selectMultipleFilesText: 'फ़ाइलों का चयन करें',
uploadErrorText: 'फ़ाइल अपलोड विफल',
uploadingText: 'अपलोड',
zoomInButtonAriaLabelText: 'ज़ूम इन',
zoomOutButtonAriaLabelText: 'ज़ूम आउट',
},
};

export default locale;