mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-07-31 14:11:46 +00:00
Add processor for i18next
This commit is contained in:
@@ -4,6 +4,7 @@ import HttpBackend from 'i18next-http-backend';
|
||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||
import {
|
||||
capitalizeAll,
|
||||
capitalizeEachFirstChar,
|
||||
capitalizeFirstChar,
|
||||
capitalizeFirstWord,
|
||||
} from './processors';
|
||||
@@ -42,6 +43,7 @@ i18n
|
||||
.use(initReactI18next)
|
||||
.use(LanguageDetector)
|
||||
.use(capitalizeAll as any)
|
||||
.use(capitalizeEachFirstChar as any)
|
||||
.use(capitalizeFirstChar as any)
|
||||
.use(capitalizeFirstWord as any)
|
||||
.init({
|
||||
|
@@ -324,7 +324,7 @@
|
||||
"blocks_next_level": "блоков до следующего уровня",
|
||||
"current_level": "текущий уровень",
|
||||
"current_status": "текущий статус",
|
||||
"current_tier": "текущий уровень (tier)",
|
||||
"current_tier": "текущий уровень",
|
||||
"details": "детали майнинга",
|
||||
"next_level": "При майнинге 24/7 вы достигнете <strong>{{ level }} уровня</strong> за <strong>{{ count }} дней</strong>",
|
||||
"rewards_info": "информация о наградах за майнинг",
|
||||
@@ -343,7 +343,7 @@
|
||||
},
|
||||
"name": "имя",
|
||||
"name_app": "имя/приложение",
|
||||
"new_post_in": "new post in {{ title }}",
|
||||
"new_post_in": "новые сообщения в {{ title }}",
|
||||
"none": "никто",
|
||||
"note": "примечание",
|
||||
"option": "вариант",
|
||||
|
@@ -4,6 +4,20 @@ export const capitalizeAll = {
|
||||
process: (value: string) => value.toUpperCase(),
|
||||
};
|
||||
|
||||
export const capitalizeEachFirstChar = {
|
||||
type: 'postProcessor',
|
||||
name: 'capitalizeEachFirstChar',
|
||||
process: (value: string) => {
|
||||
if (!value?.trim()) return value;
|
||||
|
||||
const leadingSpaces = value.match(/^\s*/)?.[0] || '';
|
||||
const trailingSpaces = value.match(/\s*$/)?.[0] || '';
|
||||
const core = value.trim().replace(/\b\w/g, (char) => char.toUpperCase());
|
||||
|
||||
return leadingSpaces + core + trailingSpaces;
|
||||
},
|
||||
};
|
||||
|
||||
export const capitalizeFirstChar = {
|
||||
type: 'postProcessor',
|
||||
name: 'capitalizeFirstChar',
|
||||
|
Reference in New Issue
Block a user