mirror of
https://github.com/mivodev/plugin-lang-br.git
synced 2026-01-26 05:15:30 +07:00
Initial commit
This commit is contained in:
38
plugin.php
Normal file
38
plugin.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Plugin Name: Portuguese (Brazil) Language Pack
|
||||
* Description: Adds Portuguese (Brazil) language support to Mivo.
|
||||
* Version: 1.0.0
|
||||
* Author: DyzulkDev
|
||||
*
|
||||
* Category: Language Pack
|
||||
* Scope: Global
|
||||
* Tags: language, portuguese, br, localization
|
||||
* Core Version: >= 1.2.0
|
||||
*/
|
||||
|
||||
use App\Core\Hooks;
|
||||
|
||||
Hooks::addFilter('get_available_languages', function($languages) {
|
||||
$languages[] = [
|
||||
'code' => 'br',
|
||||
'name' => 'Português (Brasil)',
|
||||
'flag' => 'br', // Correct ISO code
|
||||
'path' => '/lang/plugin/plugin-lang-br/br.json'
|
||||
];
|
||||
return $languages;
|
||||
});
|
||||
|
||||
// Register Route for Language File
|
||||
Hooks::addAction('router_init', function(\App\Core\Router $router) {
|
||||
$router->get('/lang/plugin/plugin-lang-br/br.json', function() {
|
||||
$path = __DIR__ . '/br.json';
|
||||
if (file_exists($path)) {
|
||||
header('Content-Type: application/json');
|
||||
readfile($path);
|
||||
exit;
|
||||
}
|
||||
http_response_code(404);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user