mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-07-28 20:51:24 +00:00
Add processor for i18next
This commit is contained in:
@@ -684,7 +684,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
sx={{ textAlign: 'center' }}
|
||||
>
|
||||
{t('core:minting.blockchain_statistics', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
</Typography>
|
||||
|
||||
@@ -696,7 +696,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
>
|
||||
<StatCard
|
||||
label={t('core:minting.average_blocktime', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={averageBlockTime(
|
||||
adminInfo,
|
||||
@@ -706,7 +706,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
|
||||
<StatCard
|
||||
label={t('core:minting.average_blocks_per_day', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={averageBlockDay(
|
||||
adminInfo,
|
||||
@@ -716,7 +716,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
|
||||
<StatCard
|
||||
label={t('core:minting.average_created_qorts_per_day', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={dayReward(
|
||||
adminInfo,
|
||||
@@ -743,7 +743,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
sx={{ textAlign: 'center' }}
|
||||
>
|
||||
{t('core:minting.account_details', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
</Typography>
|
||||
|
||||
@@ -755,19 +755,19 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
>
|
||||
<StatCard
|
||||
label={t('core:minting.current_status', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={mintingStatus(nodeStatus)}
|
||||
/>
|
||||
<StatCard
|
||||
label={t('core:minting.current_level', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={accountInfo?.level}
|
||||
/>
|
||||
<StatCard
|
||||
label={t('core:minting.blocks_next_level', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={
|
||||
levelUpBlocks(accountInfo, nodeStatus).toFixed(0) || ''
|
||||
@@ -810,7 +810,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
sx={{ textAlign: 'center' }}
|
||||
>
|
||||
{t('core:minting.rewards_info', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
</Typography>
|
||||
|
||||
@@ -822,13 +822,13 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
>
|
||||
<StatCard
|
||||
label={t('core:minting.current_tier', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={currentTier(accountInfo?.level) || ''}
|
||||
/>
|
||||
<StatCard
|
||||
label={t('core:minting.total_minter_in_tier', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={
|
||||
countMintersInLevel(
|
||||
@@ -840,7 +840,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
/>
|
||||
<StatCard
|
||||
label={t('core:minting.tier_share_per_block', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={
|
||||
tierPercent(accountInfo, tier4Online)?.toFixed(0) + ' %'
|
||||
@@ -848,7 +848,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
/>
|
||||
<StatCard
|
||||
label={t('core:minting.reward_per_block', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={
|
||||
countReward(
|
||||
@@ -861,7 +861,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
||||
/>
|
||||
<StatCard
|
||||
label={t('core:minting.reward_per_day', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
postProcess: 'capitalizeEachFirstChar',
|
||||
})}
|
||||
value={
|
||||
countRewardDay(
|
||||
|
@@ -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