Локализовать интерфейс SHiNE на русский и английский

This commit is contained in:
AidarKC
2026-11-09 16:45:21 +03:00
parent 526941eb33
commit 405b9a91a7
133 changed files with 12464 additions and 3296 deletions
+9 -8
View File
@@ -1,7 +1,8 @@
import { t } from '../i18n/index.js';
import { createTopBar } from '../components/topbar.js';
import { formatSol, getBalanceSol } from '../services/solana-wallet-service.js';
export const pageMeta = {id:'devnet-topup-view', title:'Пополнение DEVNET', showAppChrome:false};
export const pageMeta = {id:'devnet-topup-view', get title() { return t('screens.devnet_topup_view.text_001'); }, showAppChrome:false};
const DEVNET_ENDPOINT='https://api.devnet.solana.com';
function readWalletFromUrl() {
try { return new URL(window.location.href).searchParams.get('wallet')?.trim() || ''; }
@@ -10,19 +11,19 @@ function readWalletFromUrl() {
export function render() {
const screen=document.createElement('section');screen.className='stack registration-screen';
const card=document.createElement('div');card.className='card stack';
const title=document.createElement('h3');title.textContent='Пополнение DEVNET';
const title=document.createElement('h3');title.textContent=t('screens.devnet_topup_view.text_002');
const note=document.createElement('p');note.className='meta-muted';
note.textContent='Автоматическое пополнение из браузера отключено: приватный ключ отправителя нельзя публиковать в приложении. Используйте внешний доверенный Solana devnet faucet.';
note.textContent=t('screens.devnet_topup_view.text_003');
const wallet=readWalletFromUrl();
const input=document.createElement('input');input.className='input';input.readOnly=true;input.value=wallet;
const copy=document.createElement('button');copy.className='secondary-btn';copy.textContent='Скопировать адрес';
const copy=document.createElement('button');copy.className='secondary-btn';copy.textContent=t('screens.devnet_topup_view.text_004');
copy.addEventListener('click',()=>navigator.clipboard.writeText(input.value).catch(()=>{}));
const balance=document.createElement('p');balance.className='meta-muted';
balance.textContent=wallet?'Проверяем баланс…':'Не передан параметр wallet';
balance.textContent=wallet?t('screens.devnet_topup_view.text_007'):t('screens.devnet_topup_view.text_008');
if(wallet)void getBalanceSol({endpoint:DEVNET_ENDPOINT,address:wallet})
.then(value=>balance.textContent=`Баланс: ${formatSol(value.sol,6)} SOL`)
.catch(()=>balance.textContent='Баланс недоступен; проверьте адрес и сеть');
.then(value=>balance.textContent=t('screens.devnet_topup_view.text_009', { value1: formatSol(value.sol,6) }))
.catch(()=>balance.textContent=t('screens.devnet_topup_view.text_005'));
card.append(title,note,input,copy,balance);
screen.append(createTopBar({title:'Пополнение DEVNET'}),card);
screen.append(createTopBar({title:t('screens.devnet_topup_view.text_006')}),card);
return screen;
}