Skip to content

Commit

Permalink
Alert missing translation
Browse files Browse the repository at this point in the history
  • Loading branch information
dignajar committed Dec 27, 2018
1 parent 8d51674 commit 24651c1
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 48 deletions.
8 changes: 2 additions & 6 deletions boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
// Language passed via $_GET['l']
$currentLanguage = 'en';

// read the files from language directory
$acceptedLanguages = array();
$files = glob('languages/*.json');
foreach ($files as $file) {
array_push($acceptedLanguages, basename($file, ".json"));
}
//
$acceptedLanguages = array('en','es','de','ru');

if (isset($_GET['l'])) {
if (in_array($_GET['l'], $acceptedLanguages)) {
Expand Down
8 changes: 4 additions & 4 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
define('PATH_AUTHORS', PATH_METADATA.'authors'.DS);
define('CHARSET', 'UTF-8');

#define('DOMAIN', 'http://localhost:8000');
#define('CDN', 'http://localhost:8000/metadata/items/');
define('DOMAIN', 'http://localhost:8000');
define('CDN', 'http://localhost:8000/metadata/items/');

define('DOMAIN', 'https://plugins.bludit.com');
define('CDN', 'https://rawgit.com/bludit/plugins-repository/master/');
#define('DOMAIN', 'https://plugins.bludit.com');
#define('CDN', 'https://rawgit.com/bludit/plugins-repository/master/');

define('SCREENSHOT_DEFAULT', 'https://rawgit.com/bludit/plugins-repository/master/templates/screenshot.png');

Expand Down
4 changes: 4 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ function buildItem($data, $key) {
global $currentLanguage;
global $_topbar;

$data['translated'] = true;
$data['key'] = $key;
$data['screenshoot_url'] = CDN.'items/'.$data['key'].'/screenshot.png';
$data['screenshoot_twitter_url'] = CDN.'items/'.$data['key'].'/screenshot.png';
$data['screenshoot_facebook_url'] = CDN.'items/'.$data['key'].'/screenshot.png';
$data['permalink'] = rtrim($_topbar['website'],'/').'/'.ITEM_TYPE.'/'.$key;
if (!empty($data['description_'.$currentLanguage])) {
$data['description'] = $data['description_'.$currentLanguage];
} else {
$data['translated'] = false;
}

if (!empty($data['features_'.$currentLanguage])) {
$data['features'] = $data['features_'.$currentLanguage];
}
Expand Down
4 changes: 4 additions & 0 deletions html/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

<h1 style="font-size: 1.6em;" class="my-4"><?php echo $_item['name'] ?></h1>

<?php if (!$data['translated']): ?>
<div class="alert alert-warning"><?php echo l("this-plugin-has-not-yet-been-translated-into") ?></div>
<?php endif; ?>

<div class="my-4">
<img src="<?php echo $_item['screenshoot_url'] ?>" class="img-fluid item-screenshot" alt="Responsive image">
</div>
Expand Down
3 changes: 2 additions & 1 deletion languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"download-for-bludit-v2": "Download für Bludit v2.x",
"download-for-bludit-v3": "Download für Bludit v3.x",
"support": "Support",
"for-more-information-or-extra": "Weitere Informationen oder zusätzliche Konfigurationen finden Sie auf der Website des Entwicklers."
"for-more-information-or-extra": "Weitere Informationen oder zusätzliche Konfigurationen finden Sie auf der Website des Entwicklers.",
"this-plugin-has-not-yet-been-translated-into": "Dieses Plugin ist noch nicht nach Deutschland übersetzt worden. Helfen Sie uns, es zu übersetzen."
}
3 changes: 2 additions & 1 deletion languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"download-for-bludit-v2": "Download for Bludit v2.x",
"download-for-bludit-v3": "Download for Bludit v3.x",
"support": "Support",
"for-more-information-or-extra": "For more information or extra configurations, visit the developer's site."
"for-more-information-or-extra": "For more information or extra configurations, visit the developer's site.",
"this-plugin-has-not-yet-been-translated-into": "This plugin has not yet been translated into English. Help us to translate it."
}
3 changes: 2 additions & 1 deletion languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"download-for-bludit-v2": "Download for Bludit v2.x",
"download-for-bludit-v3": "Download for Bludit v3.x",
"support": "Support",
"for-more-information-or-extra": "For more information or extra configurations, visit the developer's site."
"for-more-information-or-extra": "For more information or extra configurations, visit the developer's site.",
"this-plugin-has-not-yet-been-translated-into": "Este plugin aún no ha sido traducido al Español. Ayúdanos a traducirlo."
}
33 changes: 0 additions & 33 deletions languages/it.json

This file was deleted.

3 changes: 2 additions & 1 deletion languages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"download-for-bludit-v2": "Загрузить для Bludit версий 2.x",
"download-for-bludit-v3": "Загрузить для Bludit версий 3.x",
"support": "Поддержка",
"for-more-information-or-extra": "Для получения дополнительной информации о плагине или для помощи в конфигурации плагина мы рекомендуем посетить сайт разработчика."
"for-more-information-or-extra": "Для получения дополнительной информации о плагине или для помощи в конфигурации плагина мы рекомендуем посетить сайт разработчика.",
"this-plugin-has-not-yet-been-translated-into": "Этот плагин еще не переведен на русский язык. Помогите нам перевести его."
}
2 changes: 1 addition & 1 deletion metadata
Submodule metadata updated from d1c5b1 to 8c737f

0 comments on commit 24651c1

Please sign in to comment.