mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-22 01:38:49 -05:00
(Feature) User Language System
- Need more lang files translated - Closes #25
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D
|
||||
* @license https://choosealicense.com/licenses/gpl-3.0/ GNU General Public License v3.0
|
||||
* @author HDVinnie
|
||||
*/
|
||||
|
||||
if (!function_exists('language')) {
|
||||
/**
|
||||
* Get the language instance.
|
||||
*
|
||||
* @return App\Language
|
||||
*/
|
||||
function language()
|
||||
{
|
||||
return app('language');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D
|
||||
* @license https://choosealicense.com/licenses/gpl-3.0/ GNU General Public License v3.0
|
||||
* @author HDVinnie
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Auth;
|
||||
|
||||
use App\Language;
|
||||
|
||||
class LanguageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Set locale if it's allowed.
|
||||
*
|
||||
* @param string $locale
|
||||
* @param \Illuminate\Http\Request $request
|
||||
**/
|
||||
private function setLocale($locale, $request)
|
||||
{
|
||||
// Check if is allowed and set default locale if not
|
||||
if (!Language::allowed($locale)) {
|
||||
$locale = config('app.locale');
|
||||
}
|
||||
|
||||
if (Auth::check()) {
|
||||
Auth::user()->setAttribute('locale', $locale)->save();
|
||||
} else {
|
||||
$request->session()->put('locale', $locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set locale and return home url.
|
||||
*
|
||||
* @param string $locale
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public function home($locale, Request $request)
|
||||
{
|
||||
$this->setLocale($locale, $request);
|
||||
|
||||
return redirect(url('/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set locale and return back.
|
||||
*
|
||||
* @param string $locale
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public function back($locale, Request $request)
|
||||
{
|
||||
$this->setLocale($locale, $request);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
@@ -82,5 +82,6 @@ class Kernel extends HttpKernel
|
||||
'lock' => \App\Http\Middleware\LockAccount::class,
|
||||
'immune' => \App\Http\Middleware\CheckForImmunity::class,
|
||||
'check_ip' => \App\Http\Middleware\CheckIfAlreadyVoted::class,
|
||||
'language' => \App\Http\Middleware\SetLanguage::class,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D
|
||||
* @license https://choosealicense.com/licenses/gpl-3.0/ GNU General Public License v3.0
|
||||
* @author HDVinnie
|
||||
*/
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App;
|
||||
use Auth;
|
||||
use Closure;
|
||||
|
||||
use App\Language;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SetLanguage
|
||||
{
|
||||
/**
|
||||
* This function checks if language to set is an allowed lang of config.
|
||||
*
|
||||
* @param string $locale
|
||||
**/
|
||||
private function setLocale($locale)
|
||||
{
|
||||
// Check if is allowed and set default locale if not
|
||||
if (!Language::allowed($locale)) {
|
||||
$locale = config('app.locale');
|
||||
}
|
||||
|
||||
// Set app language
|
||||
App::setLocale($locale);
|
||||
|
||||
// Set carbon language
|
||||
if (config('language.carbon')) {
|
||||
// Carbon uses only language code
|
||||
if (config('language.mode.code') == 'long') {
|
||||
$locale = explode('-', $locale)[0];
|
||||
}
|
||||
|
||||
Carbon::setLocale($locale);
|
||||
}
|
||||
|
||||
// Set date language
|
||||
if (config('language.date')) {
|
||||
// Date uses only language code
|
||||
if (config('language.mode.code') == 'long') {
|
||||
$locale = explode('-', $locale)[0];
|
||||
}
|
||||
|
||||
\Date::setLocale($locale);
|
||||
}
|
||||
}
|
||||
|
||||
public function setDefaultLocale()
|
||||
{
|
||||
$this->setLocale(config('app.locale'));
|
||||
}
|
||||
|
||||
public function setUserLocale()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user->locale) {
|
||||
$this->setLocale($user->locale);
|
||||
} else {
|
||||
$this->setDefaultLocale();
|
||||
}
|
||||
}
|
||||
|
||||
public function setSystemLocale($request)
|
||||
{
|
||||
if ($request->session()->has('locale')) {
|
||||
$this->setLocale(session('locale'));
|
||||
} else {
|
||||
$this->setDefaultLocale();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (Auth::check()) {
|
||||
$this->setUserLocale();
|
||||
} else {
|
||||
$this->setSystemLocale($request);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D
|
||||
* @license https://choosealicense.com/licenses/gpl-3.0/ GNU General Public License v3.0
|
||||
* @author HDVinnie
|
||||
*/
|
||||
|
||||
namespace App;
|
||||
|
||||
class Language
|
||||
{
|
||||
/**
|
||||
* Get single flags view.
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return mixed
|
||||
**/
|
||||
public static function flag($code = 'default')
|
||||
{
|
||||
if ($code == 'default') {
|
||||
$code = app()->getLocale();
|
||||
}
|
||||
|
||||
$name = self::getName($code);
|
||||
$code = self::country($code);
|
||||
|
||||
return view('vendor.language.flag', compact('code', 'name'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get country code based on locale.
|
||||
*
|
||||
* @param string $locale
|
||||
*
|
||||
* @return mixed
|
||||
**/
|
||||
public static function country($locale = 'default')
|
||||
{
|
||||
if ($locale == 'default') {
|
||||
$locale = app()->getLocale();
|
||||
}
|
||||
|
||||
if (config('language.mode.code', 'short') == 'short') {
|
||||
$code = strtolower(substr(self::getLongCode($locale), 3));
|
||||
} else {
|
||||
$code = strtolower(substr($locale, 3));
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all flags view.
|
||||
*
|
||||
* @return mixed
|
||||
**/
|
||||
public static function flags()
|
||||
{
|
||||
return view('vendor.language.flags');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if $code is an allowed lang.
|
||||
* Get all allowed languages.
|
||||
*
|
||||
* @param string $locale
|
||||
*
|
||||
* @return bool|array
|
||||
**/
|
||||
public static function allowed($locale = null)
|
||||
{
|
||||
if ($locale) {
|
||||
return in_array($locale, array_keys(self::allowed()));
|
||||
}
|
||||
|
||||
if (config('language.allowed')) {
|
||||
return self::names(array_merge(config('language.allowed'), [config('app.locale')]));
|
||||
} else {
|
||||
return self::names([config('app.locale')]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add names to an array of language codes as [$code => $language].
|
||||
*
|
||||
* @param array $codes
|
||||
*
|
||||
* @return array
|
||||
**/
|
||||
public static function names($codes)
|
||||
{
|
||||
// Get mode
|
||||
$mode = config('language.mode');
|
||||
|
||||
// Get languages from config
|
||||
$languages = config('language.all');
|
||||
|
||||
$array = [];
|
||||
|
||||
// Generate an array with $code as key and $code language as value
|
||||
foreach ($codes as $code) {
|
||||
$lang_name = 'Unknown';
|
||||
|
||||
foreach ($languages as $language) {
|
||||
if ($language[$mode['code']] == $code) {
|
||||
$lang_name = $language[$mode['name']];
|
||||
}
|
||||
}
|
||||
|
||||
$array[$code] = $lang_name;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add names to an array of language codes as [$language => $code].
|
||||
*
|
||||
* @param array $langs
|
||||
*
|
||||
* @return array
|
||||
**/
|
||||
public static function codes($langs)
|
||||
{
|
||||
// Get mode
|
||||
$mode = config('language.mode');
|
||||
|
||||
// Get languages from config
|
||||
$languages = config('language.all');
|
||||
|
||||
$array = [];
|
||||
|
||||
// Generate an array with $lang as key and $lang code as value
|
||||
foreach ($langs as $lang) {
|
||||
$lang_code = 'unk';
|
||||
|
||||
foreach ($languages as $language) {
|
||||
if ($language[$mode['name']] == $lang) {
|
||||
$lang_code = $language[$mode['code']];
|
||||
}
|
||||
}
|
||||
|
||||
$array[$lang] = $lang_code;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the url to set up language and return back.
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public static function back($code)
|
||||
{
|
||||
return route('language::back', ['locale' => $code]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the url to set up language and return to url('/').
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public static function home($code)
|
||||
{
|
||||
return route('language::home', ['locale' => $code]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language code.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public static function getCode($name = 'default')
|
||||
{
|
||||
if ($name == 'default') {
|
||||
$name = self::getName();
|
||||
}
|
||||
|
||||
return self::codes([$name])[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language long code.
|
||||
*
|
||||
* @param string $short
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public static function getLongCode($short = 'default')
|
||||
{
|
||||
if ($short == 'default') {
|
||||
$short = app()->getLocale();
|
||||
}
|
||||
|
||||
$long = 'en-GB';
|
||||
|
||||
// Get languages from config
|
||||
$languages = config('language.all');
|
||||
|
||||
foreach ($languages as $language) {
|
||||
if ($language['short'] != $short) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$long = $language['long'];
|
||||
}
|
||||
|
||||
return $long;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language short code.
|
||||
*
|
||||
* @param string $long
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public static function getShortCode($long = 'default')
|
||||
{
|
||||
if ($long == 'default') {
|
||||
$long = app()->getLocale();
|
||||
}
|
||||
|
||||
$short = 'en';
|
||||
|
||||
// Get languages from config
|
||||
$languages = config('language.all');
|
||||
|
||||
foreach ($languages as $language) {
|
||||
if ($language['long'] != $long) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$short = $language['short'];
|
||||
}
|
||||
|
||||
return $short;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language name.
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public static function getName($code = 'default')
|
||||
{
|
||||
if ($code == 'default') {
|
||||
$code = app()->getLocale();
|
||||
}
|
||||
|
||||
return self::names([$code])[$code];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D
|
||||
* @license https://choosealicense.com/licenses/gpl-3.0/ GNU General Public License v3.0
|
||||
* @author HDVinnie
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable All Language Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option enable language route.
|
||||
|
|
||||
*/
|
||||
'route' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable Language Home Route
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option enable language route to set language and return
|
||||
| to url('/')
|
||||
|
|
||||
*/
|
||||
'home' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Carbon Language
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option the language of carbon library.
|
||||
|
|
||||
*/
|
||||
'carbon' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Date Language
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option the language of jenssegers/date library.
|
||||
|
|
||||
*/
|
||||
'date' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Routes Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option indicates the prefix for language routes.
|
||||
|
|
||||
*/
|
||||
'prefix' => 'languages',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Flags
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option indicates the flags features.
|
||||
|
|
||||
*/
|
||||
|
||||
'flags' => ['width' => '20px', 'ul_class' => '', 'li_class' => '', 'img_class' => ''],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Language code mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option indicates the language code and name to be used, short/long
|
||||
| and english/native.
|
||||
| Short: language code (en)
|
||||
| Long: languagecode-COUNTRYCODE (en-GB)
|
||||
|
|
||||
*/
|
||||
|
||||
'mode' => ['code' => 'short', 'name' => 'native'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed languages
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This options indicates the language allowed languages.
|
||||
|
|
||||
*/
|
||||
|
||||
'allowed' => ['ar', 'de', 'en', 'es', 'et', 'fa', 'fr', 'gr', 'it', 'nl', 'pl', 'pt', 'pt-br', 'ro', 'ru', 'tr', 'tw'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| All Languages
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option indicates the language codes and names.
|
||||
|
|
||||
*/
|
||||
|
||||
'all' => [
|
||||
['short' => 'ar', 'long' => 'ar-SA', 'english' => 'Arabic', 'native' => 'العربية'],
|
||||
['short' => 'bg', 'long' => 'bg-BG', 'english' => 'Bulgarian', 'native' => 'български'],
|
||||
['short' => 'bn', 'long' => 'bn-BD', 'english' => 'Bengali', 'native' => 'বাংলা'],
|
||||
['short' => 'cn', 'long' => 'zh-CN', 'english' => 'Chinese (S)', 'native' => '简体中文'],
|
||||
['short' => 'cs', 'long' => 'cs-CZ', 'english' => 'Czech', 'native' => 'Čeština'],
|
||||
['short' => 'da', 'long' => 'da-DK', 'english' => 'Danish', 'native' => 'Dansk'],
|
||||
['short' => 'de', 'long' => 'de-DE', 'english' => 'German', 'native' => 'Deutsch'],
|
||||
['short' => 'de-aus', 'long' => 'de-AT', 'english' => 'Austrian', 'native' => 'Österreichisches Deutsch'],
|
||||
['short' => 'fa', 'long' => 'fa-FA', 'english' => 'Persian', 'native' => 'Farsi'],
|
||||
['short' => 'fi', 'long' => 'fi-FI', 'english' => 'Finnish', 'native' => 'Suomi'],
|
||||
['short' => 'fr', 'long' => 'fr-FR', 'english' => 'French', 'native' => 'Français'],
|
||||
['short' => 'el', 'long' => 'el-GR', 'english' => 'Greek', 'native' => 'Ελληνικά'],
|
||||
['short' => 'en', 'long' => 'en-AU', 'english' => 'English (AU)', 'native' => 'English (AU)'],
|
||||
['short' => 'en', 'long' => 'en-CA', 'english' => 'English (CA)', 'native' => 'English (CA)'],
|
||||
['short' => 'en', 'long' => 'en-GB', 'english' => 'English (GB)', 'native' => 'English (GB)'],
|
||||
['short' => 'en', 'long' => 'en-US', 'english' => 'English (US)', 'native' => 'English (US)'],
|
||||
['short' => 'es', 'long' => 'es-ES', 'english' => 'Spanish', 'native' => 'Español'],
|
||||
['short' => 'et', 'long' => 'et-EE', 'english' => 'Estonian', 'native' => 'Eesti'],
|
||||
['short' => 'he', 'long' => 'he-IL', 'english' => 'Hebrew', 'native' => 'עִבְרִית'],
|
||||
['short' => 'hi', 'long' => 'hi-IN', 'english' => 'Hindi', 'native' => 'हिन्दी'],
|
||||
['short' => 'hr', 'long' => 'hr-HR', 'english' => 'Croatian', 'native' => 'Hrvatski'],
|
||||
['short' => 'hu', 'long' => 'hu-HU', 'english' => 'Hungarian', 'native' => 'Magyar'],
|
||||
['short' => 'hy', 'long' => 'hy-AM', 'english' => 'Armenian', 'native' => 'Հայերեն'],
|
||||
['short' => 'id', 'long' => 'id-ID', 'english' => 'Indonesian', 'native' => 'Bahasa Indonesia'],
|
||||
['short' => 'it', 'long' => 'it-IT', 'english' => 'Italian', 'native' => 'Italiano'],
|
||||
['short' => 'ir', 'long' => 'fa-IR', 'english' => 'Persian', 'native' => 'فارسی'],
|
||||
['short' => 'lt', 'long' => 'lt-LT', 'english' => 'Lithuanian', 'native' => 'Lietuvių'],
|
||||
['short' => 'jp', 'long' => 'ja-JP', 'english' => 'Japanese', 'native' => '日本語'],
|
||||
['short' => 'ko', 'long' => 'ko-KR', 'english' => 'Korean', 'native' => '한국어'],
|
||||
['short' => 'ms', 'long' => 'ms-MY', 'english' => 'Malay', 'native' => 'Bahasa Melayu'],
|
||||
['short' => 'mx', 'long' => 'es-MX', 'english' => 'Mexico', 'native' => 'Español de México'],
|
||||
['short' => 'nb', 'long' => 'nb-NO', 'english' => 'Norwegian', 'native' => 'Norsk Bokmål'],
|
||||
['short' => 'nl', 'long' => 'nl-NL', 'english' => 'Dutch', 'native' => 'Nederlands'],
|
||||
['short' => 'pl', 'long' => 'pl-PL', 'english' => 'Polish', 'native' => 'Polski'],
|
||||
['short' => 'pt-br', 'long' => 'pt-BR', 'english' => 'Brazilian', 'native' => 'Português do Brasil'],
|
||||
['short' => 'pt', 'long' => 'pt-PT', 'english' => 'Portuguese', 'native' => 'Português'],
|
||||
['short' => 'ro', 'long' => 'ro-RO', 'english' => 'Romanian', 'native' => 'Română'],
|
||||
['short' => 'ru', 'long' => 'ru-RU', 'english' => 'Russian', 'native' => 'Русский'],
|
||||
['short' => 'sq', 'long' => 'sq-AL', 'english' => 'Albanian', 'native' => 'Shqip'],
|
||||
['short' => 'sv', 'long' => 'sv-SE', 'english' => 'Swedish', 'native' => 'Svenska'],
|
||||
['short' => 'th', 'long' => 'th-TH', 'english' => 'Thai', 'native' => 'ไทย'],
|
||||
['short' => 'tr', 'long' => 'tr-TR', 'english' => 'Turkish', 'native' => 'Türkçe'],
|
||||
['short' => 'tw', 'long' => 'zh-TW', 'english' => 'Chinese (T)', 'native' => '繁體中文'],
|
||||
['short' => 'uk', 'long' => 'uk-UA', 'english' => 'Ukrainian', 'native' => 'Українська'],
|
||||
['short' => 'vn', 'long' => 'vi-VN', 'english' => 'Vietnamese', 'native' => 'Tiếng Việt'],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddLocaleColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function ($table) {
|
||||
$table->string('locale')->default(config('app.locale'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function ($table) {
|
||||
$table->dropColumn('locale');
|
||||
});
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Articles Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'meta-articles' => 'Articles and news on the tracker and the community',
|
||||
'read-more' => 'Read More',
|
||||
'published-at' => 'Published At ',
|
||||
'articles' => 'Articles',
|
||||
];
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'failed' => 'These credentials do not match our records.',
|
||||
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
||||
'login' => 'Login',
|
||||
'signup' => 'Signup',
|
||||
'logout' => 'Logout',
|
||||
'username' => 'Username',
|
||||
'password' => 'Password',
|
||||
'lost-password' => 'Forgot Your Password?',
|
||||
'recover-my-password' => 'Recover My Password',
|
||||
'remember-me' => 'Remember Me',
|
||||
];
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Blocks Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
// Chat
|
||||
'chatbox' => 'Chat Box',
|
||||
|
||||
// Featured Torrents
|
||||
'featured-torrents' => 'Featured Torrents',
|
||||
|
||||
// Latest Torrents
|
||||
'latest-torrents' => 'Latest Torrents',
|
||||
|
||||
// Latest Posts
|
||||
'latest-posts' => 'Latest Posts',
|
||||
|
||||
// Latest Topics
|
||||
'latest-topics' => 'Latest Topics',
|
||||
|
||||
// Users Online
|
||||
'users-online' => 'Users Online',
|
||||
|
||||
// News/Articles
|
||||
'new-news' => 'New News',
|
||||
'check-news' => 'News (Check Daily)',
|
||||
];
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| BON Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'bon' => 'BON',
|
||||
'bonus' => 'Bonus',
|
||||
'points' => 'Points',
|
||||
'your-points' => 'Your Points',
|
||||
'store' => 'Store',
|
||||
'gift-to' => 'Gift Bonus Points To?',
|
||||
'gift' => 'Gift Bonus Points',
|
||||
'exchange' => 'Exchange',
|
||||
'exchange-warning' => 'Exchanges are final, Please double check your choices before making an exchange.',
|
||||
'no-refund' => 'NO REFUNDS!',
|
||||
'active' => 'Activated!',
|
||||
'earning' => 'Earning',
|
||||
'per-hour' => 'Points Per Hour',
|
||||
'item' => 'Item',
|
||||
'total' => 'Total Earnings',
|
||||
];
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Common Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'home' => 'Home',
|
||||
'account' => 'Account',
|
||||
'username' => 'Username',
|
||||
'password' => 'Password',
|
||||
'download' => 'Download',
|
||||
'upload' => 'Upload',
|
||||
'ratio' => 'Ratio',
|
||||
'warnings' => 'Warnings',
|
||||
'members' => 'Members',
|
||||
'navigation' => 'Navigation',
|
||||
'notifications' => 'Notifications',
|
||||
'added_on' => 'Added On',
|
||||
'search' => 'Search',
|
||||
'quick-search' => 'Quick Search',
|
||||
'submit' => 'Submit',
|
||||
'comment' => 'Comment',
|
||||
'view-all' => 'View All',
|
||||
'preview' => 'Preview',
|
||||
'edit' => 'Edit',
|
||||
'delete' => 'Delete',
|
||||
'pending' => 'Pending',
|
||||
'stats' => 'Stats',
|
||||
'extra-stats' => 'Extra-Stats',
|
||||
'rules' => 'Rules',
|
||||
'faq' => 'FAQ',
|
||||
'report' => 'Report',
|
||||
'bug' => 'Report A Bug',
|
||||
'results' => 'Results',
|
||||
'contact' => 'Contact',
|
||||
'about' => 'About Us',
|
||||
];
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cofig Manager Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'title' => 'Config Manager',
|
||||
'info_choose' => 'Choose a file to start editing',
|
||||
'file' => 'File',
|
||||
'path' => 'Path',
|
||||
'header' => [
|
||||
'key' => 'Key',
|
||||
'value' => 'Value',
|
||||
'actions' => 'Actions',
|
||||
],
|
||||
'actions' => [
|
||||
'edit' => 'Edit',
|
||||
'confirm' => 'Save new key',
|
||||
'save' => 'Save!',
|
||||
'cancel' => 'Cancel',
|
||||
],
|
||||
'sure' => 'Are you sure?',
|
||||
];
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Forums Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'forum' => 'Forum',
|
||||
'forums' => 'Forums',
|
||||
'topics' => 'Topics',
|
||||
'post' => 'Post',
|
||||
'replies' => 'Replies',
|
||||
'views' => 'Views',
|
||||
'meta-category' => 'List of forums in the category',
|
||||
'create-new-topic' => 'Create New Topic',
|
||||
'topic-title' => 'Title of this topic',
|
||||
'send-new-topic' => 'Save this topic',
|
||||
'read-topic' => 'Read the topic',
|
||||
'mark-as-resolved' => 'Lock Topic',
|
||||
'delete-topic' => 'Delete this topic',
|
||||
'display-forum' => 'Show topics in ',
|
||||
];
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Graveyard Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'graveyard' => 'Graveyard',
|
||||
];
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Private Message Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'unread' => 'Unread',
|
||||
'read' => 'Read',
|
||||
'inbox' => 'Inbox',
|
||||
'outbox' => 'Outbox',
|
||||
'message' => 'Message',
|
||||
'messages' => 'Messages',
|
||||
'private' => 'Private',
|
||||
'new' => 'New Message',
|
||||
'from' =>'From',
|
||||
'to' => 'To',
|
||||
'sent' => 'Sent',
|
||||
'sent-at' => 'Sent At',
|
||||
'subject' =>'Subject',
|
||||
'recieved-at' =>'Recieved At',
|
||||
'search' => 'Search By Subject',
|
||||
'reply' => 'Reply',
|
||||
'send' => 'Send',
|
||||
'create' => 'Create',
|
||||
'select' => 'Select A User',
|
||||
];
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Polls Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'poll' => 'Poll',
|
||||
'polls' => 'Polls',
|
||||
'current' => 'Current Poll(s)',
|
||||
'total' => 'Total Votes Ever',
|
||||
'vote-now' => 'Get Your Vote In Now!',
|
||||
'results' => 'Poll Results',
|
||||
'multiple-choice' => 'This is a multiple choice poll. Select as many answers as you like.',
|
||||
'ip-checking' => 'This poll has duplicate vote checking. You can only vote once.',
|
||||
'vote' => 'Vote',
|
||||
'votes' => 'Votes',
|
||||
];
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Requests Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'requests' => 'Requests',
|
||||
'request' => 'Request',
|
||||
];
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Staff Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'moderation' => 'Moderation',
|
||||
'please-moderate' => 'Please Moderate This Torrent!',
|
||||
'you-have' => 'You Have',
|
||||
'dashboard' => 'Dashboard',
|
||||
'staff-dashboard' => 'Staff Dashboard',
|
||||
];
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Torrent Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'bookmark' => 'Bookmark',
|
||||
'bookmarks' => 'Bookmarks',
|
||||
'torrent' => 'Torrent',
|
||||
'torrents' => 'Torrents',
|
||||
'category' => 'Category',
|
||||
'categories' => 'Categories',
|
||||
'catalog' => 'Catalog',
|
||||
'catalogs' => 'Catalogs',
|
||||
'type' => 'Type',
|
||||
'types' => 'Types',
|
||||
'history' => 'History',
|
||||
'peers' => 'Peers',
|
||||
'seeder' => 'Seeder',
|
||||
'leecher' => 'Leecher',
|
||||
'seeders' => 'Seeders',
|
||||
'leechers' => 'Leechers',
|
||||
'rss' => 'RSS',
|
||||
'name' => 'Name',
|
||||
'size' => 'Size',
|
||||
'times' => 'Times',
|
||||
'completed' => 'Completed',
|
||||
'released' => 'Released',
|
||||
'title' => 'Title',
|
||||
'titles' => 'Titles'
|
||||
];
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
return [
|
||||
'my-profile' => 'My Profile',
|
||||
];
|
||||
@@ -1,117 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
'accepted' => 'The :attribute must be accepted.',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
'alpha' => 'The :attribute may only contain letters.',
|
||||
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
|
||||
'alpha_num' => 'The :attribute may only contain letters and numbers.',
|
||||
'array' => 'The :attribute must be an array.',
|
||||
'before' => 'The :attribute must be a date before :date.',
|
||||
'between' => [
|
||||
'numeric' => 'The :attribute must be between :min and :max.',
|
||||
'file' => 'The :attribute must be between :min and :max kilobytes.',
|
||||
'string' => 'The :attribute must be between :min and :max characters.',
|
||||
'array' => 'The :attribute must have between :min and :max items.',
|
||||
],
|
||||
'boolean' => 'The :attribute field must be true or false.',
|
||||
'confirmed' => 'The :attribute confirmation does not match.',
|
||||
'date' => 'The :attribute is not a valid date.',
|
||||
'date_format' => 'The :attribute does not match the format :format.',
|
||||
'different' => 'The :attribute and :other must be different.',
|
||||
'digits' => 'The :attribute must be :digits digits.',
|
||||
'digits_between' => 'The :attribute must be between :min and :max digits.',
|
||||
'dimensions' => 'The :attribute has invalid image dimensions.',
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'email' => 'The :attribute must be a valid email address.',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'file' => 'The :attribute must be a file.',
|
||||
'filled' => 'The :attribute field is required.',
|
||||
'image' => 'The :attribute must be an image.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in_array' => 'The :attribute field does not exist in :other.',
|
||||
'integer' => 'The :attribute must be an integer.',
|
||||
'ip' => 'The :attribute must be a valid IP address.',
|
||||
'json' => 'The :attribute must be a valid JSON string.',
|
||||
'max' => [
|
||||
'numeric' => 'The :attribute may not be greater than :max.',
|
||||
'file' => 'The :attribute may not be greater than :max kilobytes.',
|
||||
'string' => 'The :attribute may not be greater than :max characters.',
|
||||
'array' => 'The :attribute may not have more than :max items.',
|
||||
],
|
||||
'mimes' => 'The :attribute must be a file of type: :values.',
|
||||
'mimetypes' => 'The :attribute must be a file of type: :values.',
|
||||
'min' => [
|
||||
'numeric' => 'The :attribute must be at least :min.',
|
||||
'file' => 'The :attribute must be at least :min kilobytes.',
|
||||
'string' => 'The :attribute must be at least :min characters.',
|
||||
'array' => 'The :attribute must have at least :min items.',
|
||||
],
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'numeric' => 'The :attribute must be a number.',
|
||||
'present' => 'The :attribute field must be present.',
|
||||
'regex' => 'The :attribute format is invalid.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||
'required_with' => 'The :attribute field is required when :values is present.',
|
||||
'required_with_all' => 'The :attribute field is required when :values is present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||
'same' => 'The :attribute and :other must match.',
|
||||
'size' => [
|
||||
'numeric' => 'The :attribute must be :size.',
|
||||
'file' => 'The :attribute must be :size kilobytes.',
|
||||
'string' => 'The :attribute must be :size characters.',
|
||||
'array' => 'The :attribute must contain :size items.',
|
||||
],
|
||||
'string' => 'The :attribute must be a string.',
|
||||
'timezone' => 'The :attribute must be a valid zone.',
|
||||
'unique' => 'The :attribute has already been taken.',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
'url' => 'The :attribute format is invalid.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify custom validation messages for attributes using the
|
||||
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||
| specify a specific custom language line for a given attribute rule.
|
||||
|
|
||||
*/
|
||||
|
||||
'custom' => [
|
||||
'attribute-name' => [
|
||||
'rule-name' => 'custom-message',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used to swap attribute place-holders
|
||||
| with something more reader friendly such as E-Mail Address instead
|
||||
| of "email". This simply helps us make messages a little cleaner.
|
||||
|
|
||||
*/
|
||||
|
||||
'attributes' => [],
|
||||
|
||||
];
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<link rel="stylesheet" href="{{ url('css/nav/hoe.css?v=05') }}">
|
||||
<link rel="stylesheet" href="{{ url('css/main/app.css?v=04') }}">
|
||||
<link rel="stylesheet" href="{{ url('css/main/custom.css?v=36') }}">
|
||||
<link rel="stylesheet" href="{{ url('css/main/custom.css?v=37') }}">
|
||||
@if(Auth::check()) @if(Auth::user()->style != 0)
|
||||
<link rel="stylesheet" href="{{ url('css/main/dark.css?v=02') }}">
|
||||
@endif @endif
|
||||
@@ -148,6 +148,20 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown hoe-rheader-submenu hoe-header-profile">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<span>Language <i class=" fa fa-angle-down"></i></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu ">
|
||||
@foreach (App\Language::allowed() as $code => $name)
|
||||
<li class="{{ config('language.flags.li_class') }}">
|
||||
<a href="{{ route('back', ['local' => $code]) }}">
|
||||
<img src="{{ url('img/flags/'.strtolower($code).'.png') }}" alt="{{ $name }}" width="{{ config('language.flags.width') }}" /> {{ $name }} @if(Auth::user()->locale == $code)<span class="text-orange text-bold">(Active!)</span>@endif
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
@@ -29,17 +29,8 @@
|
||||
|
||||
<div class="tab-content block block-titled">
|
||||
<div role="tabpanel" class="tab-pane active" id="welcome">
|
||||
<h3>Language Settings</h3>
|
||||
<hr>
|
||||
{{ Form::open(array('url' => '/{username}.{id}/settings','role' => 'form', 'class' => 'login-frm')) }}
|
||||
{{ csrf_field() }}
|
||||
<div class="form-group">
|
||||
<label for="language" class="control-label">Language</label>
|
||||
<select class="form-control" id="language" name="language">
|
||||
<option value="English">English</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
{{ Form::open(array('url' => '/{username}.{id}/settings','role' => 'form', 'class' => 'login-frm')) }}
|
||||
<h3>Style Settings</h3>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group(['middleware' => 'language'], function () {
|
||||
|
||||
/*
|
||||
|------------------------------------------
|
||||
| Website (Not Authorized)
|
||||
@@ -222,6 +224,9 @@ Route::group(['middleware' => 'auth'], function () {
|
||||
Route::any('/{username}.{id}/settings/change_email', 'UserController@changeEmail')->name('change_email');
|
||||
Route::any('/{username}.{id}/settings/change_pid', 'UserController@changePID')->name('change_pid');
|
||||
|
||||
// User Language
|
||||
Route::get('/{locale}/back', 'LanguageController@back')->name('back');
|
||||
|
||||
// User Clients
|
||||
Route::any('/{username}.{id}/clients', 'UserController@clients')->name('user_clients');
|
||||
Route::post('/{username}.{id}/addcli', 'UserController@authorizeClient')->name('addcli');
|
||||
@@ -442,3 +447,4 @@ Route::group(['prefix' => 'staff_dashboard', 'middleware' => ['auth', 'modo'], '
|
||||
Route::get('/masspm', 'MassPMController@massPM')->name('massPM');
|
||||
Route::post('/masspm/send', 'MassPMController@sendMassPM')->name('sendMassPM');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user