Support for localization

This commit is contained in:
mmk2410 2015-07-03 11:19:40 +02:00
parent 51cd71846b
commit aa1bc50648
3 changed files with 13 additions and 4 deletions

View file

@ -34,4 +34,5 @@ $rcc = 'no';
$nav_drawer = 'yes'; $nav_drawer = 'yes';
// Set here the name of your theme. Read the documentation for more themes // Set here the name of your theme. Read the documentation for more themes
$theme = 'material-light'; $theme = 'material-light';
?> // Set here your language. The file must exist in the lang directory
$language = "en";

View file

@ -27,6 +27,7 @@ THE SOFTWARE.
<?php <?php
include 'config.php'; include 'config.php';
include './lang/' . $language . ".php";
require_once 'res/php/Parsedown.php'; require_once 'res/php/Parsedown.php';
require_once 'res/php/ArticleGenerator.php'; require_once 'res/php/ArticleGenerator.php';
require_once './res/php/BlogListGenerator.php'; require_once './res/php/BlogListGenerator.php';
@ -67,7 +68,7 @@ THE SOFTWARE.
<?php <?php
if ($getarticle == "") { if ($getarticle == "") {
echo "<section>"; echo "<section>";
echo "<div class='nav-item-static'>Blogs of $blogtitle:</div>"; echo "<div class='nav-item-static'>$LANG_Blogs_Of" . " " . "$blogtitle:</div>";
$blogs = scandir("./blogs/"); $blogs = scandir("./blogs/");
foreach ($blogs as $blog) { foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") { if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
@ -183,12 +184,12 @@ THE SOFTWARE.
</div> </div>
<div class="fabmenu"> <div class="fabmenu">
<div class="subfab"> <div class="subfab">
<a href='mailto:?subject=<?php echo $blogtitle; ?>&body=Check out this blog: <?php echo $url; ?>' target="blank"> <a href='mailto:?subject=<?php echo $blogtitle; ?>&body=<?php echo $LANG_Check_out_this_blog;?>: <?php echo $url; ?>' target="blank">
<img src="./res/img/email.svg" class="subfab-img" /> <img src="./res/img/email.svg" class="subfab-img" />
</a> </a>
</div> </div>
<div class="subfab"> <div class="subfab">
<a href='https://twitter.com/intent/tweet?text=Check out: <?php echo $url; ?>&original_referer=' target="blank"> <a href='https://twitter.com/intent/tweet?text=<?php echo $LANG_Check_out;?>: <?php echo $url; ?>&original_referer=' target="blank">
<img src="./res/img/twitter.svg" class="subfab-img" /> <img src="./res/img/twitter.svg" class="subfab-img" />
</a> </a>
</div> </div>

7
lang/en.php Normal file
View file

@ -0,0 +1,7 @@
<?php
// This is the default language file for PHP
$LANG_Blogs_Of = "Blogs of";
$LANG_Check_out_this_blog = "Check out this blog";
$LANG_Check_out = "Check out";