mirror of
https://github.com/flarum/framework.git
synced 2025-01-21 20:24:14 +08:00
extractText from translations where strings expected
This commit is contained in:
parent
cc69211977
commit
1bdfe0112c
|
@ -16,6 +16,7 @@ import RequestError from '../../common/utils/RequestError';
|
|||
import { Extension } from '../AdminApplication';
|
||||
import { IPageAttrs } from '../../common/components/Page';
|
||||
import type Mithril from 'mithril';
|
||||
import extractText from '../../common/utils/extractText';
|
||||
|
||||
export interface ExtensionPageAttrs extends IPageAttrs {
|
||||
id: string;
|
||||
|
@ -156,7 +157,7 @@ export default class ExtensionPage<Attrs extends ExtensionPageAttrs = ExtensionP
|
|||
|
||||
if (!this.isEnabled()) {
|
||||
const purge = () => {
|
||||
if (confirm(app.translator.trans('core.admin.extension.confirm_purge'))) {
|
||||
if (confirm(extractText(app.translator.trans('core.admin.extension.confirm_purge')))) {
|
||||
app
|
||||
.request({
|
||||
url: app.forum.attribute('apiUrl') + '/extensions/' + this.extension.id,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import app from '../../common/app';
|
||||
import extractText from './extractText';
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
// TODO: translation
|
||||
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) {
|
||||
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 {
|
||||
return number.toString();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import isSafariMobile from './utils/isSafariMobile';
|
|||
import type Notification from './components/Notification';
|
||||
import type Post from './components/Post';
|
||||
import Discussion from '../common/models/Discussion';
|
||||
import extractText from '../common/utils/extractText';
|
||||
|
||||
export default class ForumApplication extends Application {
|
||||
/**
|
||||
|
@ -99,7 +100,7 @@ export default class ForumApplication extends Application {
|
|||
}
|
||||
|
||||
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'));
|
||||
|
||||
|
@ -124,8 +125,9 @@ export default class ForumApplication extends Application {
|
|||
app.history.home();
|
||||
|
||||
// Reload the current user so that their unread notification count is refreshed.
|
||||
if (app.session.user) {
|
||||
app.store.find('users', app.session.user.id());
|
||||
const userId = app.session.user?.id()
|
||||
if (userId) {
|
||||
app.store.find('users', userId);
|
||||
m.redraw();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user