1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 13:10:24 +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 a23180f279
commit c08b62af80
32 changed files with 578 additions and 4096 deletions

View File

@@ -66,12 +66,13 @@ export default class PostStreamScrubber extends Component {
view() {
const retain = this.subtree.retain();
const count = this.count();
const unreadCount = this.props.stream.discussion.unreadCount();
const unreadPercent = Math.min(this.count() - this.index, unreadCount) / this.count();
const unreadPercent = Math.min(count - this.index, unreadCount) / count;
const viewing = app.trans('core.forum.post_scrubber_viewing_text', {
const viewing = app.translator.transChoice('core.forum.post_scrubber_viewing_text', count, {
index: <span className="Scrubber-index">{retain || formatNumber(this.visibleIndex())}</span>,
count: <span className="Scrubber-count">{formatNumber(this.count())}</span>
count: <span className="Scrubber-count">{formatNumber(count)}</span>
});
function styleUnread(element, isInitialized, context) {