mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
Update for composer branch, add svg icon
This commit is contained in:
10
extensions/lang-english/assets/icon.svg
Normal file
10
extensions/lang-english/assets/icon.svg
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30" width="1200" height="600">
|
||||||
|
<clipPath id="t">
|
||||||
|
<path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/>
|
||||||
|
</clipPath>
|
||||||
|
<path d="M0,0 v30 h60 v-30 z" fill="#00247d"/>
|
||||||
|
<path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"/>
|
||||||
|
<path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(#t)" stroke="#cf142b" stroke-width="4"/>
|
||||||
|
<path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/>
|
||||||
|
<path d="M30,0 v30 M0,15 h60" stroke="#cf142b" stroke-width="6"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 522 B |
@@ -1,31 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Flarum\Events\RegisterLocales;
|
use Flarum\Events\RegisterLocales;
|
||||||
use Illuminate\Events\Dispatcher;
|
use Flarum\Core\Application;
|
||||||
|
|
||||||
return function (Dispatcher $events) {
|
return function (Application $app) {
|
||||||
$events->listen(RegisterLocales::class, function(RegisterLocales $event) {
|
$app->make('events')->listen(RegisterLocales::class, function(RegisterLocales $event) {
|
||||||
$locale = $name = null;
|
$name = $title = basename(__DIR__);
|
||||||
|
|
||||||
if (file_exists($manifest = __DIR__.'/flarum.json')) {
|
if (file_exists($manifest = __DIR__.'/composer.json')) {
|
||||||
$json = json_decode(file_get_contents($manifest), true);
|
$json = json_decode(file_get_contents($manifest), true);
|
||||||
$locale = array_key_exists('locale', $json) ? $json['locale'] : null;
|
|
||||||
$name = array_key_exists('name', $json) ? $json['name'] : null;
|
if (empty($json)) {
|
||||||
unset($json);
|
throw new RuntimeException("Error parsing composer.json in $name: ".json_last_error_msg());
|
||||||
|
}
|
||||||
|
|
||||||
|
$locale = array_get($json, 'extra.flarum-locale.code');
|
||||||
|
$title = array_get($json, 'extra.flarum-locale.title', $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($name === null) {
|
if (! isset($locale)) {
|
||||||
throw new RuntimeException("Language pack ".__DIR__." needs a \"name\" in flarum.json.");
|
throw new RuntimeException("Language pack $name must define \"extra.flarum-locale.code\" in composer.json.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($locale === null) {
|
$event->addLocale($locale, $title);
|
||||||
throw new RuntimeException("Language pack {$name} needs a \"locale\" in flarum.json.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$event->addLocale($locale, $name);
|
|
||||||
|
|
||||||
if (! is_dir($localeDir = __DIR__.'/locale')) {
|
if (! is_dir($localeDir = __DIR__.'/locale')) {
|
||||||
throw new RuntimeException("Language pack {$name} needs a \"locale\" subdirectory.");
|
throw new RuntimeException("Language pack $name must have a \"locale\" subdirectory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($file = $localeDir.'/config.js')) {
|
if (file_exists($file = $localeDir.'/config.js')) {
|
||||||
@@ -36,9 +36,7 @@ return function (Dispatcher $events) {
|
|||||||
$event->addConfig($locale, $file);
|
$event->addConfig($locale, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = new DirectoryIterator($localeDir);
|
foreach (new DirectoryIterator($localeDir) as $file) {
|
||||||
|
|
||||||
foreach ($files as $file) {
|
|
||||||
if ($file->isFile() && in_array($file->getExtension(), ['yml', 'yaml'])) {
|
if ($file->isFile() && in_array($file->getExtension(), ['yml', 'yaml'])) {
|
||||||
$event->addTranslations($locale, $file->getPathname());
|
$event->addTranslations($locale, $file->getPathname());
|
||||||
}
|
}
|
||||||
|
29
extensions/lang-english/composer.json
Normal file
29
extensions/lang-english/composer.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "flarum/english",
|
||||||
|
"type": "flarum-extension",
|
||||||
|
"description": "English language pack.",
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"composer/installers": "dev-master"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"flarum-extension": {
|
||||||
|
"title": "English",
|
||||||
|
"icon": {
|
||||||
|
"backgroundImage": "url('{$assets}/icon.svg')",
|
||||||
|
"backgroundSize": "cover",
|
||||||
|
"backgroundPosition": "center"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flarum-locale": {
|
||||||
|
"code": "en",
|
||||||
|
"title": "English"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/tobscure/installers"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "english",
|
|
||||||
"title": "English",
|
|
||||||
"locale": "en",
|
|
||||||
"description": "English language pack.",
|
|
||||||
"keywords": ["language"],
|
|
||||||
"version": "0.1.0-beta.3",
|
|
||||||
"author": {
|
|
||||||
"name": "Toby Zerner",
|
|
||||||
"email": "toby@flarum.org",
|
|
||||||
"homepage": "http://tobyzerner.com"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"require": {
|
|
||||||
"flarum": ">=0.1.0-beta.3"
|
|
||||||
},
|
|
||||||
"support": {
|
|
||||||
"source": "https://github.com/flarum/english",
|
|
||||||
"issues": "https://github.com/flarum/core/issues"
|
|
||||||
},
|
|
||||||
"icon": {
|
|
||||||
"name": "language",
|
|
||||||
"backgroundColor": "#eee",
|
|
||||||
"color": "#000"
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user