]> git.mxchange.org Git - friendica.git/commitdiff
i18n officially ready for prime time.
authorMike Macgirvin <mike@macgirvin.com>
Thu, 7 Oct 2010 00:40:58 +0000 (17:40 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Thu, 7 Oct 2010 00:40:58 +0000 (17:40 -0700)
boot.php
include/Contact.php
index.php
util/README

index 7bf3e75a6b2de3a7b8e9f78e842899e1a347a8be..194ee6a01b02a5064fc90038f01654c55cefe84f 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -169,6 +169,15 @@ class App {
 
 }}
 
+// retrieve the App structure
+// useful in functions which require it but don't get it passed to them
+
+if(! function_exists('get_app')) {
+function get_app() {
+       global $a;
+       return $a;
+}};
+
 
 // Multi-purpose function to check variable state.
 // Usage: x($var) or $x($array,'key')
@@ -269,19 +278,21 @@ function replace_macros($s,$r) {
 
 
 // load string tranlsation table for alternate language
-// not yet implemented
 
 if(! function_exists('load_translation_table')) {
 function load_translation_table($lang) {
        global $a;
 
+       if(file_exists("view/$lang/strings.php"))
+               include("view/$lang/strings.php");
 }}
 
 // translate string if translation exists
 
 if(! function_exists('t')) {
 function t($s) {
-       global $a;
+       
+       $a = get_app();
 
        if($a->strings[$s])
                return $a->strings[$s];
index c59038e5d7528f281af2e8a96c2a035b586c2d09..a915ae0b444883045097ccfb6d8a8e91e9c64b48 100644 (file)
@@ -1,6 +1,27 @@
 <?php
 
 
+// Included here for completeness, but this is a very dangerous operation.
+// It is the caller's responsibility to confirm the requestor's intent and
+// authorisation to do this.
+
+function user_remove($uid) {
+       q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `group` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `group_member` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `intro` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `item` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `mail` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `photo` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `profile` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `profile_check` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `user` WHERE `uid` = %d", intval($uid));
+       if($uid == get_uid()) {
+               unset($_SESSION['authenticated']);
+               unset($_SESSION['uid']);
+               killme();
+       }
+}
 
 
 function contact_remove($id) {
index f86fbe13843802bc3d08abf125070f819be51c1e..ce2d32316a8d867e6e9e29ff86eb432ea818e368 100644 (file)
--- a/index.php
+++ b/index.php
@@ -6,11 +6,15 @@ $a = new App;
 
 $debug_text = ''; // Debugging functions should never be used on production systems.
 
-// Setup the database.
+// Setup the language and database.
 
 $install = ((file_exists('.htconfig.php')) ? false : true);
 
 @include(".htconfig.php");
+
+if(x($lang))
+       load_translation_table($lang);
+
 require_once("dba.php");
 $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
        unset($db_host, $db_user, $db_pass, $db_data);
index ee164d10391e52c70d0aad3cad2d4d8f09c5527a..5dca64265a671dca798362f49afa8723ca1f4e70 100644 (file)
@@ -10,7 +10,11 @@ tinymce, simplepie, and the HTML parsers.
 
 In order for extract to do its job, every use of the t() translation function 
 must be preceded by one space. The string also can not contain parentheses. If
-parens are required in a string, please use hex escapes.
+parens are required in a string which requires translation, please use hex escapes.
+
+\x28 = (
+\x29 = )
+
 
 strings.php - a recent run of the strings program. This provides output that
 is suitable for direct inclusion in the program once the app has been 
@@ -19,7 +23,14 @@ initialised.
 There are also translatable strings in the various files in the view 
 directory. By setting $lang = 'something' in .htconfig.php, the application 
 will search for view/something/filename prior to the English version in 
-view/filename when loading templates and view files.
+view/filename when loading templates and view files. The translated string table
+should be placed in view/$lang/strings.php for automatic inclusion.
+
+You are not restricted to using known languages. You may also use this to
+translate the software into "pirate", "surfer" or merely to replace certain
+text which you don't care for.  
+
+