From 970a41c61eea52bd0d79d29f54f0eb2be8c7a890 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Fri, 3 Jul 2015 19:36:37 -0300 Subject: [PATCH] Languages support --- admin/views/add-user.php | 2 +- admin/views/dashboard.php | 8 ++--- admin/views/edit-page.php | 2 +- admin/views/edit-post.php | 4 +-- admin/views/edit-user.php | 34 +++++++++--------- admin/views/login.php | 10 +++--- admin/views/manage-pages.php | 10 +++--- admin/views/manage-posts.php | 12 +++---- admin/views/new-page.php | 6 ++-- admin/views/new-post.php | 4 +-- admin/views/plugins.php | 8 ++--- admin/views/settings.php | 69 ++++++++++++++++++------------------ admin/views/users.php | 16 ++++----- kernel/dblanguage.class.php | 22 ++++++++---- languages/en_US.json | 42 +++++++++++++++------- 15 files changed, 139 insertions(+), 110 deletions(-) diff --git a/admin/views/add-user.php b/admin/views/add-user.php index a68ed49f..827b2acb 100644 --- a/admin/views/add-user.php +++ b/admin/views/add-user.php @@ -35,4 +35,4 @@ p('Cancel') ?> - + \ No newline at end of file diff --git a/admin/views/dashboard.php b/admin/views/dashboard.php index 04e2503f..5573e4ca 100644 --- a/admin/views/dashboard.php +++ b/admin/views/dashboard.php @@ -26,14 +26,14 @@
-
Database regenerated
-
New posts and pages synchronized.
+
p('database-regenerated') ?>
+
p('new-posts-and-pages-synchronized') ?>
-

Notifications

+

p('notifications') ?>

-
+ \ No newline at end of file diff --git a/admin/views/edit-page.php b/admin/views/edit-page.php index 6a2a1537..a760c7a9 100644 --- a/admin/views/edit-page.php +++ b/admin/views/edit-page.php @@ -123,4 +123,4 @@ $(document).ready(function() }); - + \ No newline at end of file diff --git a/admin/views/edit-post.php b/admin/views/edit-post.php index 19e312a6..3af9d7f4 100644 --- a/admin/views/edit-post.php +++ b/admin/views/edit-post.php @@ -20,7 +20,7 @@ } else { - echo '

Enable more features at Settings->Advanced->Writting Settings

'; + echo '

'.$Language->p('Enable more features at').''.$Language->p('settings-advanced-writting-settings').'

'; echo ' @@ -59,13 +59,13 @@ - Cancel + p('Cancel') ?> @@ -78,16 +78,16 @@ - Cancel + p('Cancel') ?> - + \ No newline at end of file diff --git a/admin/views/login.php b/admin/views/login.php index a8fa4153..f94592db 100644 --- a/admin/views/login.php +++ b/admin/views/login.php @@ -1,13 +1,13 @@ -

Login

+

p('Login') ?>

- +

-
+ \ No newline at end of file diff --git a/admin/views/manage-pages.php b/admin/views/manage-pages.php index 968d53e2..22c18e12 100644 --- a/admin/views/manage-pages.php +++ b/admin/views/manage-pages.php @@ -1,12 +1,12 @@ -

Manage Pages

+

p('Manage pages') ?>

- - + + @@ -24,7 +24,7 @@ } echo ''; - echo ''; + echo ''; echo ''; echo ''; } @@ -32,4 +32,4 @@ ?> -
TitleParentp('Title') ?>p('Parent') ?>
'.($Page->parentKey()?NO_PARENT_CHAR:'').''.($Page->published()?'':'[DRAFT] ').($Page->title()?$Page->title():'[Empty title] ').''.($Page->parentKey()?NO_PARENT_CHAR:'').''.($Page->published()?'':'['.$Language->g('Draft').'] ').($Page->title()?$Page->title():'['.$Language->g('Empty title').'] ').''.$parentTitle.'
+ \ No newline at end of file diff --git a/admin/views/manage-posts.php b/admin/views/manage-posts.php index fd2ddab6..708ea430 100644 --- a/admin/views/manage-posts.php +++ b/admin/views/manage-posts.php @@ -1,13 +1,13 @@ -

Manage Posts

+

p('Manage posts') ?>

- - - + + + @@ -16,7 +16,7 @@ foreach($posts as $Post) { echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; @@ -24,4 +24,4 @@ ?> -
TitlePublished dateModified datep('Title') ?>p('Published date') ?>p('Modified date') ?>
'.($Post->published()?'':'[DRAFT] ').($Post->title()?$Post->title():'[Empty title] ').''.($Post->published()?'':'['.$Language->g('Draft').'] ').($Post->title()?$Post->title():'['.$Language->g('Empty title').'] ').''.$Post->dateCreated().''.$Post->timeago().'
+ \ No newline at end of file diff --git a/admin/views/new-page.php b/admin/views/new-page.php index 1b7028b8..32f4eb0c 100644 --- a/admin/views/new-page.php +++ b/admin/views/new-page.php @@ -1,4 +1,4 @@ -

New page

+

p('New page') ?>

@@ -18,7 +18,7 @@ } else { - echo '

'.$Language->p('Enable more features at').''.$Language->p('settings-advanced-writting-settings').'

'; + echo '

'.$Language->g('Enable more features at').''.$Language->g('settings-advanced-writting-settings').'

'; echo '
@@ -47,10 +47,11 @@ +
-

Writting Settings

+

p('Writting settings') ?>

  • advancedOptions()?'checked':'' ?>> - -
    Add or edit description, tags or modify the friendly URL.
    + +
    p('add-or-edit-description-tags-or') ?>
-

URL Filters

+

p('URL Filters') ?>

- +
@@ -110,7 +111,7 @@
- +
@@ -164,4 +165,4 @@ $(document).ready(function() {

Bludit version

-
+ \ No newline at end of file diff --git a/admin/views/users.php b/admin/views/users.php index ec95f00f..6f9a4ac9 100644 --- a/admin/views/users.php +++ b/admin/views/users.php @@ -1,16 +1,16 @@ -

Users

+

p('Users') ?>

- - - - - - + + + + + + @@ -29,4 +29,4 @@ } ?> -
UsernameFirst NameLast NameRoleEmailRegisteredp('Username') ?>p('First name') ?>p('Last name') ?>p('Role') ?>p('Email') ?>p('Registered') ?>
+ \ No newline at end of file diff --git a/kernel/dblanguage.class.php b/kernel/dblanguage.class.php index fe543424..ffd48963 100644 --- a/kernel/dblanguage.class.php +++ b/kernel/dblanguage.class.php @@ -46,9 +46,9 @@ class dbLanguage extends dbJSON } // Return the translation, if the translation does'n exist then return the English translation. - public function get($text) + public function get($string) { - $key = Text::lowercase($text); + $key = Text::lowercase($string); $key = Text::replace(' ', '-', $key); if(isset($this->db[$key])) @@ -58,10 +58,20 @@ class dbLanguage extends dbJSON return $this->en_US[$key]; } - // Print the translation. - public function p($text) + public function g($string) { - echo $this->get($text); + return $this->get($string); + } + + public function print($string) + { + echo $this->get($string); + } + + // Print the translation. + public function p($string) + { + $this->print($string); } public function add($array) @@ -69,4 +79,4 @@ class dbLanguage extends dbJSON $this->db[] = $array; } -} +} \ No newline at end of file diff --git a/languages/en_US.json b/languages/en_US.json index ce936f9a..323cbfba 100644 --- a/languages/en_US.json +++ b/languages/en_US.json @@ -16,7 +16,7 @@ "dashboard": "Dashboard", "role": "Role", "posts": "Posts", - "Users": "Users", + "users": "Users", "administrator": "Administrator", "add": "Add", "cancel": "Cancel", @@ -25,10 +25,7 @@ "no-parent": "No parent", "edit-page": "Edit page", "edit-post": "Edit post", - "you-can-choose-the-users-privilege": "You can choose the user's privilege. The editor role only can write pages and posts.", - "email-will-not-be-publicly-displayed": "Email will not be publicly displayed. Recommended for recovery password and notifications.", "add-a-new-user": "Add a new user", - "html-markdown-code-supported": "HTML and Markdown code supported.", "parent": "Parent", "friendly-url": "Friendly URL", "description": "Description", @@ -37,15 +34,36 @@ "save": "Save", "draft": "Draft", "delete": "Delete", + "registered": "Registered", + "Notifications": "notifications", + "profile": "Profile", + "email": "Email", + "edit-user": "Edit user", + "publish-now": "Publish now", + "first-name": "First name", + "last-name": "Last name", + "manage-pages": "Manage pages", "advanced-options": "Advanced options", + "database-regenerated": "Database regenerated", + "html-markdown-code-supported": "HTML and Markdown code supported.", "enable-more-features-at": "Enable more features at", "settings-advanced-writting-settings": "Settings->Advanced->Writting Settings", - "publish-now": "Publish now", - "delete": "Delete", - "delete": "Delete", - "delete": "Delete", - "delete": "Delete", - "delete": "Delete", - "delete": "Delete" - + "new-posts-and-pages-synchronized": "New posts and pages synchronized.", + "you-can-choose-the-users-privilege": "You can choose the user's privilege. The editor role only can write pages and posts.", + "email-will-not-be-publicly-displayed": "Email will not be publicly displayed. Recommended for recovery password and notifications.", + "use-this-field-to-name-your-site": "Use this field to name your site, it will appear at the top of every page of your site.", + "use-this-field-to-add-a-catchy-prhase": "Use this field to add a catchy prhase on your site.", + "you-can-add-a-site-description-to-provide": "You can add a site description to provide a short bio or description of your site.", + "you-can-add-a-small-text-on-the-bottom": "You can add a small text on the bottom of every page. eg: copyright, owner, dates, etc.", + "number-of-posts-to-show-per-page": "Number of posts to show per page.", + "the-url-of-your-site": "The URL of your site.", + "add-or-edit-description-tags-or": "Add or edit description, tags or modify the friendly URL.", + "select-your-sites-language": "Select your site's language.", + "select-a-timezone-for-a-correct": "Select a timezone for a correct date/time display on your site.", + "you-can-use-this-field-to-define-a-set-of": "You can use this field to define a set of parameters related to the languege, country and special preferences.", + "email": "Email", + "email": "Email", + "email": "Email", + "email": "Email", + "email": "Email" } \ No newline at end of file