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

Allowing override of product locale to add custom client side transla… #1501

Merged
merged 2 commits into from
Jan 10, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"FileCloseAccessText": "Enter 키를 눌러 파일 삭제",
"FileSizeGreater": "파일 ${0}이(가) 예상 크기 ${1}MB를 초과합니다.",
"FileNameInvalid": "파일 이름이 (.)으로 시작하거나, \\ / : * ? \" < > | ; % $를 포함하거나, nul, prn, con, lpt 또는 com과 같이 예약된 키워드인 파일은 첨부하지 마십시오.",
"FileMimeTypeInvalid": "파일 ${0}은(는) 지원되지 않는 파일 유형입니다.",
"InternalFormSubmissionError": "temp"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,90 @@
{
"FileCloseAccessText" : "กด Enter เพื่อลบไฟล์ ",
"FileSizeGreater" : "ไฟล์ ${0} ใหญ่กว่าขนาดที่คาดไว้: ${1}MB",
"FileNameInvalid" : "ห้ามแนบไฟล์ที่ชื่อไฟล์ขึ้นต้นด้วย (.) มี \\ / : * ? \" < > | ; % $ หรือเป็นคีย์เวิร์ดที่สงวนไว้ เช่น nul, prn, con, lpt หรือ com",
"FileMimeTypeInvalid" : "ไฟล์ ${0} เป็นประเภทไฟล์ที่ไม่รองรับ",
"InternalFormSubmissionError" : "พบข้อผิดพลาดภายในขณะส่งแบบฟอร์ม",
"type" : "กรุณาใส่ค่าที่ถูกต้อง.",
"required" : "กรุณากรอกข้อมูลในช่องนี้.",
"minimum" : "ค่าต้องมากกว่าหรือเท่ากับ ${0}.",
"maximum" : "ค่าต้องน้อยกว่าหรือเท่ากับ ${0}",
"minLength" : "โปรดขยายข้อความนี้ให้มีความยาว ${0} ตัวอักษรขึ้นไป.",
"maxLength" : "โปรดย่อข้อความนี้ให้เหลือ ${0} ตัวอักษรหรือน้อยกว่า.",
"step" : "กรุณาใส่ค่าที่ถูกต้อง.",
"format" : "ระบุค่าในรูปแบบที่อนุญาต : ${0}.",
"pattern" : "กรุณาตรงกับรูปแบบที่ร้องขอ.",
"minItems" : "ระบุจำนวนรายการเท่ากับหรือมากกว่า ${0}.",
"maxItems" : "ระบุจำนวนรายการเท่ากับหรือน้อยกว่า ${0}",
"uniqueItems" : "รายการทั้งหมดจะต้องไม่ซ้ำกัน",
"validationExpression" : "กรุณาใส่ค่าที่ถูกต้อง.",
"maxFileSize" : "ไฟล์มีขนาดใหญ่เกินไป ลดขนาดแล้วลองอีกครั้ง.",
"accept" : "ไม่รองรับประเภทไฟล์ที่ระบุ.",
"defaultError" : "มีข้อผิดพลาดในสนาม",
"clearText" : "ลอสเชน",
"0" : "๐",
"calendarSymbols" : {
"monthNames" : [
"มกราคม",
"กุมภาพันธ์",
"มีนาคม",
"เมษายน",
"พฤษภาคม",
"มิถุนายน",
"กรกฎาคม",
"สิงหาคม",
"กันยายน",
"ตุลาคม",
"พฤศจิกายน",
"ธันวาคม"
],
"abbrmonthNames" : [
"ม.ค.",
"ก.พ.",
"มี.ค.",
"เม.ย.",
"พ.ค.",
"มิ.ย.",
"ก.ค.",
"ส.ค.",
"ก.ย.",
"ต.ค.",
"พ.ย.",
"ธ.ค."
],
"dayNames" : [
"วันอาทิตย์",
"วันจันทร์",
"วันอังคาร",
"วันพุธ",
"วันพฤหัสบดี",
"วันศุกร์",
"วันเสาร์"
],
"abbrdayNames" : [
"อา.",
"จ.",
"อ.",
"พ.",
"พฤ.",
"ศ.",
"ส."
],
"meridiemNames" : [
"vorm.",
"nachm."
],
"eraNames" : [
"v. Chr.",
"n. Chr."
],
"day": "วัน",
"days": "วัน",
"month": "เดือน",
"months": "เดือน",
"year": "ปี",
"years": "ปี",
"more": "มากกว่า",
"less": "น้อย"
},
"Zero" : "๐"
}
25 changes: 11 additions & 14 deletions ui.frontend/src/LanguageUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,17 @@ class LanguageUtils {
* @fires module:FormView~Constants#FORM_LANGUAGE_INITIALIZED
*/
static async loadLang(lang, url, executeConfigsAndFireEvent = false) {
if (!(lang in this.#langData)) {
// todo: avoid doing this call in product json if locale not found
// todo: can't find a condition today, since language client library can be overlaid too
const _langData = await HTTPAPILayer.getJson(url);
if(_langData) {
console.debug("fetched language data", _langData);
this.#langData[lang] = _langData;
setCustomDefaultConstraintTypeMessages(_langData);
}
if (executeConfigsAndFireEvent) {
await this.#executeLanguageConfigs(lang);
const event = new CustomEvent(Constants.FORM_LANGUAGE_INITIALIZED, {"detail": lang});
document.dispatchEvent(event);
}
// someone can override the product locale as well, hence not adding this check --- if (!(lang in this.#langData))
const _langData = await HTTPAPILayer.getJson(url);
if(_langData) {
console.debug("fetched language data", _langData);
this.#langData[lang] = _langData;
setCustomDefaultConstraintTypeMessages(_langData);
}
if (executeConfigsAndFireEvent) {
await this.#executeLanguageConfigs(lang);
const event = new CustomEvent(Constants.FORM_LANGUAGE_INITIALIZED, {"detail": lang});
document.dispatchEvent(event);
}
}

Expand Down
4 changes: 2 additions & 2 deletions ui.tests/test-module/libs/commons/localeDataSets.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ const languages = [
I18N_STRINGS: {
"FileCloseAccessText" : "Enter 키를 눌러 파일 삭제",
"FileSizeGreater" : "파일 ${0}이(가) 예상 크기 ${1}MB를 초과합니다.",
"FileNameInvalid" : '파일 이름이 (.)으로 시작하거나, \\ / : * ? " < > | ; % $를 포함하거나, nul, prn, con, lpt 또는 com과 같이 예약된 키워드인 파일은 첨부하지 마십시오.',
"FileNameInvalid" : "파일 이름이 (.)으로 시작하거나, \\ / : * ? \" < > | ; % $를 포함하거나, nul, prn, con, lpt 또는 com과 같이 예약된 키워드인 파일은 첨부하지 마십시오.",
"FileMimeTypeInvalid" : "파일 ${0}은(는) 지원되지 않는 파일 유형입니다.",
"InternalFormSubmissionError" : "양식을 제출하는 중 내부 오류가 발생했습니다."
"InternalFormSubmissionError" : "temp"
}
}, {
LANGUAGE: 'Chinese Traditional', LOCALE: 'zh-tw', TRANSLATION: {
Expand Down
Loading