mirror of
https://github.com/mivodev/plugin-lang-es.git
synced 2026-01-25 21:08:54 +07:00
39 lines
977 B
PHP
39 lines
977 B
PHP
<?php
|
|
|
|
/**
|
|
* Plugin Name: Spanish Language Pack
|
|
* Description: Adds Spanish (Español) language support to Mivo.
|
|
* Version: 1.0.0
|
|
* Author: DyzulkDev
|
|
*
|
|
* Category: Language Pack
|
|
* Scope: Global
|
|
* Tags: language, spanish, es, localization
|
|
* Core Version: >= 1.2.0
|
|
*/
|
|
|
|
use App\Core\Hooks;
|
|
|
|
Hooks::addFilter('get_available_languages', function($languages) {
|
|
$languages[] = [
|
|
'code' => 'es',
|
|
'name' => 'Español',
|
|
'flag' => 'es', // Correct ISO code
|
|
'path' => '/lang/plugin/plugin-lang-es/es.json'
|
|
];
|
|
return $languages;
|
|
});
|
|
|
|
// Register Route for Language File
|
|
Hooks::addAction('router_init', function(\App\Core\Router $router) {
|
|
$router->get('/lang/plugin/plugin-lang-es/es.json', function() {
|
|
$path = __DIR__ . '/es.json';
|
|
if (file_exists($path)) {
|
|
header('Content-Type: application/json');
|
|
readfile($path);
|
|
exit;
|
|
}
|
|
http_response_code(404);
|
|
});
|
|
});
|