mirror of
https://github.com/flarum/core.git
synced 2025-08-03 15:07:53 +02:00
extractText from translations where strings expected
This commit is contained in:
@@ -16,6 +16,7 @@ import RequestError from '../../common/utils/RequestError';
|
|||||||
import { Extension } from '../AdminApplication';
|
import { Extension } from '../AdminApplication';
|
||||||
import { IPageAttrs } from '../../common/components/Page';
|
import { IPageAttrs } from '../../common/components/Page';
|
||||||
import type Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
|
import extractText from '../../common/utils/extractText';
|
||||||
|
|
||||||
export interface ExtensionPageAttrs extends IPageAttrs {
|
export interface ExtensionPageAttrs extends IPageAttrs {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -156,7 +157,7 @@ export default class ExtensionPage<Attrs extends ExtensionPageAttrs = ExtensionP
|
|||||||
|
|
||||||
if (!this.isEnabled()) {
|
if (!this.isEnabled()) {
|
||||||
const purge = () => {
|
const purge = () => {
|
||||||
if (confirm(app.translator.trans('core.admin.extension.confirm_purge'))) {
|
if (confirm(extractText(app.translator.trans('core.admin.extension.confirm_purge')))) {
|
||||||
app
|
app
|
||||||
.request({
|
.request({
|
||||||
url: app.forum.attribute('apiUrl') + '/extensions/' + this.extension.id,
|
url: app.forum.attribute('apiUrl') + '/extensions/' + this.extension.id,
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import app from '../../common/app';
|
import app from '../../common/app';
|
||||||
|
import extractText from './extractText';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `abbreviateNumber` utility converts a number to a shorter localized form.
|
* The `abbreviateNumber` utility converts a number to a shorter localized form.
|
||||||
@@ -10,9 +11,9 @@ import app from '../../common/app';
|
|||||||
export default function abbreviateNumber(number: number): string {
|
export default function abbreviateNumber(number: number): string {
|
||||||
// TODO: translation
|
// TODO: translation
|
||||||
if (number >= 1000000) {
|
if (number >= 1000000) {
|
||||||
return Math.floor(number / 1000000) + app.translator.trans('core.lib.number_suffix.mega_text');
|
return Math.floor(number / 1000000) + extractText(app.translator.trans('core.lib.number_suffix.mega_text'));
|
||||||
} else if (number >= 1000) {
|
} else if (number >= 1000) {
|
||||||
return (number / 1000).toFixed(1) + app.translator.trans('core.lib.number_suffix.kilo_text');
|
return (number / 1000).toFixed(1) + extractText(app.translator.trans('core.lib.number_suffix.kilo_text'));
|
||||||
} else {
|
} else {
|
||||||
return number.toString();
|
return number.toString();
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@ import isSafariMobile from './utils/isSafariMobile';
|
|||||||
import type Notification from './components/Notification';
|
import type Notification from './components/Notification';
|
||||||
import type Post from './components/Post';
|
import type Post from './components/Post';
|
||||||
import Discussion from '../common/models/Discussion';
|
import Discussion from '../common/models/Discussion';
|
||||||
|
import extractText from '../common/utils/extractText';
|
||||||
|
|
||||||
export default class ForumApplication extends Application {
|
export default class ForumApplication extends Application {
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +100,7 @@ export default class ForumApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.routes[defaultAction].path = '/';
|
this.routes[defaultAction].path = '/';
|
||||||
this.history.push(defaultAction, this.translator.trans('core.forum.header.back_to_index_tooltip'), '/');
|
this.history.push(defaultAction, extractText(this.translator.trans('core.forum.header.back_to_index_tooltip')), '/');
|
||||||
|
|
||||||
this.pane = new Pane(document.getElementById('app'));
|
this.pane = new Pane(document.getElementById('app'));
|
||||||
|
|
||||||
@@ -124,8 +125,9 @@ export default class ForumApplication extends Application {
|
|||||||
app.history.home();
|
app.history.home();
|
||||||
|
|
||||||
// Reload the current user so that their unread notification count is refreshed.
|
// Reload the current user so that their unread notification count is refreshed.
|
||||||
if (app.session.user) {
|
const userId = app.session.user?.id()
|
||||||
app.store.find('users', app.session.user.id());
|
if (userId) {
|
||||||
|
app.store.find('users', userId);
|
||||||
m.redraw();
|
m.redraw();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user