mirror of
https://github.com/flarum/core.git
synced 2025-10-12 15:34:26 +02:00
* Replace gulp with webpack and npm scripts for JS compilation * Set up Travis CI to commit compiled JS * Restructure `js` directory; only one instance of npm, forum/admin are "submodules" * Refactor JS initializers into Application subclasses * Maintain partial compatibility API (importing from absolute paths) for extensions * Remove minification responsibility from PHP asset compiler * Restructure `less` directory
34 lines
746 B
PHP
34 lines
746 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Flarum\Frontend\Asset;
|
|
|
|
class LocaleJsCompiler extends JsCompiler
|
|
{
|
|
protected $translations = [];
|
|
|
|
public function setTranslations(array $translations)
|
|
{
|
|
$this->translations = $translations;
|
|
}
|
|
|
|
public function compile()
|
|
{
|
|
$output = 'flarum.core.app.translator.translations='.json_encode($this->translations).";\n";
|
|
|
|
foreach ($this->files as $filename) {
|
|
$output .= file_get_contents($filename);
|
|
}
|
|
|
|
return $this->format($output);
|
|
}
|
|
}
|