1
0
mirror of https://github.com/flarum/core.git synced 2025-07-23 01:31:40 +02:00

Add third tier to key namespacing

- Changes all `app.trans` calls to `app.translator.trans` calls.
- Changes existing keys to [three-tier namespace structure](https://github.com/flarum/english/pull/12).
- Extracts additional strings for `lib:` namespace.
- Extracts two previously missed strings for EditGroupModal.js.
This commit is contained in:
dcsjapan
2015-10-20 13:04:43 +09:00
parent ebb4623223
commit f520a8b9ac
54 changed files with 216 additions and 216 deletions

View File

@@ -255,16 +255,16 @@ export default class App {
case 401:
case 403:
children = 'You do not have permission to do that.';
children = app.translator.trans('core.lib.error.permission_denied_message');
break;
case 404:
case 410:
children = 'The requested resource was not found.';
children = app.translator.trans('core.lib.error.not_found_message');
break;
default:
children = 'Oops! Something went wrong. Please reload the page and try again.';
children = app.translator.trans('core.lib.error.generic_message');
}
error.alert = new Alert({

View File

@@ -11,7 +11,7 @@
*/
export default function punctuateSeries(items) {
if (items.length === 2) {
return app.trans('core.lib.series_two_text', {
return app.translator.trans('core.lib.series.two_text', {
first: items[0],
second: items[1]
});
@@ -21,10 +21,10 @@ export default function punctuateSeries(items) {
// into the translator along with the first and last item.
const second = items
.slice(1, items.length - 1)
.reduce((list, item) => list.concat([item, app.trans('core.lib.series_glue_text')]), [])
.reduce((list, item) => list.concat([item, app.translator.trans('core.lib.series.glue_text')]), [])
.slice(0, -1);
return app.trans('core.lib.series_three_text', {
return app.translator.trans('core.lib.series.three_text', {
first: items[0],
second,
third: items[items.length - 1]

View File

@@ -6,7 +6,7 @@
* @return {Object}
*/
export default function username(user) {
const name = (user && user.username()) || app.trans('core.forum.user_deleted_text');
const name = (user && user.username()) || app.translator.trans('core.lib.deleted_user_text');
return <span className="username">{name}</span>;
}

View File

@@ -86,7 +86,7 @@ Object.assign(Discussion.prototype, {
const items = new ItemList();
if (this.isHidden()) {
items.add('hidden', <Badge type="hidden" icon="trash" label="Hidden"/>);
items.add('hidden', <Badge type="hidden" icon="trash" label={app.translator.trans('core.lib.hidden_discussion_tooltip')}/>);
}
return items;

View File

@@ -11,9 +11,9 @@
export default function abbreviateNumber(number) {
// TODO: translation
if (number >= 1000000) {
return Math.floor(number / 1000000) + 'M';
return Math.floor(number / 1000000) + app.translator.trans('core.lib.number_suffix.mega_text');
} else if (number >= 1000) {
return Math.floor(number / 1000) + 'K';
return Math.floor(number / 1000) + app.translator.trans('core.lib.number_suffix.kilo_text');
} else {
return number.toString();
}