mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-12 14:37:03 +03:00
feat: migrate static texts to locales
This commit is contained in:
@@ -10,12 +10,12 @@ export function renderModal(text: string) {
|
||||
E('div', { class: 'pdk-partial-modal__footer' }, [
|
||||
renderButton({
|
||||
classNames: ['cbi-button-apply'],
|
||||
text: 'Copy content',
|
||||
text: _('Copy'),
|
||||
onClick: () => {},
|
||||
}),
|
||||
renderButton({
|
||||
classNames: ['cbi-button-remove'],
|
||||
text: 'Close modal',
|
||||
text: _('Close'),
|
||||
onClick: ui.hideModal,
|
||||
}),
|
||||
]),
|
||||
|
||||
@@ -31,12 +31,12 @@ async function fetchSystemInfo() {
|
||||
store.set({
|
||||
diagnosticsSystemInfo: {
|
||||
loading: false,
|
||||
podkop_version: 'unknown',
|
||||
podkop_latest_version: 'unknown',
|
||||
luci_app_version: 'unknown',
|
||||
sing_box_version: 'unknown',
|
||||
openwrt_version: 'unknown',
|
||||
device_model: 'unknown',
|
||||
podkop_version: _('unknown'),
|
||||
podkop_latest_version: _('unknown'),
|
||||
luci_app_version: _('unknown'),
|
||||
sing_box_version: _('unknown'),
|
||||
openwrt_version: _('unknown'),
|
||||
device_model: _('unknown'),
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -214,9 +214,7 @@ async function handleShowGlobalCheck() {
|
||||
const globalCheck = await PodkopShellMethods.globalCheck();
|
||||
|
||||
if (globalCheck.success) {
|
||||
console.log('globalCheck', globalCheck.data);
|
||||
|
||||
ui.showModal('Global check', renderModal(globalCheck.data as string));
|
||||
ui.showModal(_('Global check'), renderModal(globalCheck.data as string));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('handleShowGlobalCheck - e', e);
|
||||
@@ -243,9 +241,7 @@ async function handleViewLogs() {
|
||||
const viewLogs = await PodkopShellMethods.checkLogs();
|
||||
|
||||
if (viewLogs.success) {
|
||||
console.log('viewLogs', viewLogs.data);
|
||||
|
||||
ui.showModal('View logs', renderModal(viewLogs.data as string));
|
||||
ui.showModal(_('View logs'), renderModal(viewLogs.data as string));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('handleViewLogs - e', e);
|
||||
@@ -272,10 +268,8 @@ async function handleShowSingBoxConfig() {
|
||||
const showSingBoxConfig = await PodkopShellMethods.showSingBoxConfig();
|
||||
|
||||
if (showSingBoxConfig.success) {
|
||||
console.log('showSingBoxConfig', showSingBoxConfig.data);
|
||||
|
||||
ui.showModal(
|
||||
'Show sing-box config',
|
||||
_('Show sing-box config'),
|
||||
renderModal(showSingBoxConfig.data as string),
|
||||
);
|
||||
}
|
||||
@@ -370,7 +364,7 @@ function renderDiagnosticSystemInfoWidget() {
|
||||
|
||||
function getPodkopVersionRow(): IRenderSystemInfoRow {
|
||||
const loading = diagnosticsSystemInfo.loading;
|
||||
const unknown = diagnosticsSystemInfo.podkop_version === 'unknown';
|
||||
const unknown = diagnosticsSystemInfo.podkop_version === _('unknown');
|
||||
const hasActualVersion = Boolean(
|
||||
diagnosticsSystemInfo.podkop_latest_version,
|
||||
);
|
||||
@@ -391,7 +385,7 @@ function renderDiagnosticSystemInfoWidget() {
|
||||
key: 'Podkop',
|
||||
value: version,
|
||||
tag: {
|
||||
label: 'Outdated',
|
||||
label: _('Outdated'),
|
||||
kind: 'warning',
|
||||
},
|
||||
};
|
||||
@@ -401,7 +395,7 @@ function renderDiagnosticSystemInfoWidget() {
|
||||
key: 'Podkop',
|
||||
value: version,
|
||||
tag: {
|
||||
label: 'Latest',
|
||||
label: _('Latest'),
|
||||
kind: 'success',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ export function renderAvailableActions({
|
||||
classNames: ['cbi-button-apply'],
|
||||
onClick: restart.onClick,
|
||||
icon: renderRotateCcwIcon24,
|
||||
text: 'Restart podkop',
|
||||
text: _('Restart podkop'),
|
||||
loading: restart.loading,
|
||||
disabled: restart.disabled,
|
||||
}),
|
||||
@@ -56,7 +56,7 @@ export function renderAvailableActions({
|
||||
classNames: ['cbi-button-remove'],
|
||||
onClick: stop.onClick,
|
||||
icon: renderCircleStopIcon24,
|
||||
text: 'Stop podkop',
|
||||
text: _('Stop podkop'),
|
||||
loading: stop.loading,
|
||||
disabled: stop.disabled,
|
||||
}),
|
||||
@@ -66,7 +66,7 @@ export function renderAvailableActions({
|
||||
classNames: ['cbi-button-save'],
|
||||
onClick: start.onClick,
|
||||
icon: renderCirclePlayIcon24,
|
||||
text: 'Start podkop',
|
||||
text: _('Start podkop'),
|
||||
loading: start.loading,
|
||||
disabled: start.disabled,
|
||||
}),
|
||||
@@ -76,7 +76,7 @@ export function renderAvailableActions({
|
||||
classNames: ['cbi-button-remove'],
|
||||
onClick: disable.onClick,
|
||||
icon: renderPauseIcon24,
|
||||
text: 'Disable autostart',
|
||||
text: _('Disable autostart'),
|
||||
loading: disable.loading,
|
||||
disabled: disable.disabled,
|
||||
}),
|
||||
@@ -86,7 +86,7 @@ export function renderAvailableActions({
|
||||
classNames: ['cbi-button-save'],
|
||||
onClick: enable.onClick,
|
||||
icon: renderPlayIcon24,
|
||||
text: 'Enable autostart',
|
||||
text: _('Enable autostart'),
|
||||
loading: enable.loading,
|
||||
disabled: enable.disabled,
|
||||
}),
|
||||
@@ -95,7 +95,7 @@ export function renderAvailableActions({
|
||||
renderButton({
|
||||
onClick: globalCheck.onClick,
|
||||
icon: renderCircleCheckBigIcon24,
|
||||
text: 'Get global check',
|
||||
text: _('Get global check'),
|
||||
loading: globalCheck.loading,
|
||||
disabled: globalCheck.disabled,
|
||||
}),
|
||||
@@ -104,7 +104,7 @@ export function renderAvailableActions({
|
||||
renderButton({
|
||||
onClick: viewLogs.onClick,
|
||||
icon: renderSquareChartGanttIcon24,
|
||||
text: 'View logs',
|
||||
text: _('View logs'),
|
||||
loading: viewLogs.loading,
|
||||
disabled: viewLogs.disabled,
|
||||
}),
|
||||
@@ -113,7 +113,7 @@ export function renderAvailableActions({
|
||||
renderButton({
|
||||
onClick: showSingBoxConfig.onClick,
|
||||
icon: renderCogIcon24,
|
||||
text: 'Show sing-box config',
|
||||
text: _('Show sing-box config'),
|
||||
loading: showSingBoxConfig.loading,
|
||||
disabled: showSingBoxConfig.disabled,
|
||||
}),
|
||||
|
||||
@@ -186,5 +186,5 @@ export function renderCheckSection(props: IRenderCheckSectionProps) {
|
||||
return renderSkippedState(props);
|
||||
}
|
||||
|
||||
return E('div', {}, 'Not implement yet');
|
||||
return E('div', {}, _('Not implement yet'));
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export function renderRunAction({
|
||||
}: IRenderDiagnosticRunActionProps) {
|
||||
return E('div', { class: 'pdk_diagnostic-page__run_check_wrapper' }, [
|
||||
renderButton({
|
||||
text: 'Run Diagnostic',
|
||||
text: _('Run Diagnostic'),
|
||||
onClick: click,
|
||||
icon: renderSearchIcon24,
|
||||
loading,
|
||||
|
||||
Reference in New Issue
Block a user