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

Refactor translation and validation

We now use Symfony's Translation component. Yay! We get more powerful pluralisation and better a fallback mechanism. Will want to implement the caching mechanism at some point too. The API is replicated in JavaScript, which could definitely use some testing.

Validators have been refactored so that they are decoupled from models completely (i.e. they simply validate arrays of user input). Language packs should include Laravel's validation messages.

ref #267
This commit is contained in:
Toby Zerner
2015-10-15 22:30:45 +10:30
parent 154465069d
commit bc3fa5d451
32 changed files with 578 additions and 4096 deletions

View File

@@ -123,7 +123,7 @@ export default class PermissionGrid extends Component {
return SettingDropdown.component({
defaultLabel: minutes
? app.trans('core.admin.permissions_allow_some_minutes_button', {count: minutes})
? app.translator.transChoice('core.admin.permissions_allow_some_minutes_button', minutes, {count: minutes})
: app.trans('core.admin.permissions_allow_indefinitely_button'),
key: 'allow_renaming',
options: [
@@ -155,7 +155,7 @@ export default class PermissionGrid extends Component {
return SettingDropdown.component({
defaultLabel: minutes
? app.trans('core.admin.permissions_allow_some_minutes_button', {count: minutes})
? app.translator.transChoice('core.admin.permissions_allow_some_minutes_button', minutes, {count: minutes})
: app.trans('core.admin.permissions_allow_indefinitely_button'),
key: 'allow_post_editing',
options: [