-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
38 lines (34 loc) · 977 Bytes
/
plugin.php
File metadata and controls
38 lines (34 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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);
});
});