Example #1
0
 /**
  * this function to create links for post in a valiable language (translation post)
  * 
  * @param number $id
  * @param string $table
  * @return boolean|string
  */
 private function valiableLang($id = '', $table = '')
 {
     // check if $id and $table are set
     if ($id && $table) {
         // call function checkIfContentExistInCurrentLanguage() to know
         // valiable languages .
         $this->checkIfContentExistInCurrentLanguage($table, $id);
         // if current language are exist return false!
         /**
          * i know you ask yourself WHY ????
          * if option hide untranslation is false we want to show users all posts (in current language and other)
          * so if any post exist in (current language and other language) the system well be desplay same post 2 more time
          * so we check if this post exist in current language show user this post in current language only.
          * 
          * too learn more see block code in line: 333 - 379 
          */
         if (in_array(currentLang(), $this->_valiableLang)) {
             return false;
         }
         /**
          * @var string $lang to store links for avaliable language in and return it.
          */
         // get initial bracket
         $langs = ' (';
         // get all languages of post translated in and get tongue name
         foreach ($this->_valiableLang as $lang) {
             $langs .= languageNameIntongue($lang) . ' - ';
         }
         // remove lanst dash
         $langs = rtrim($langs, ' - ');
         // close bracket
         $langs .= ')';
         return $langs;
     } else {
         // if $id and $table not set
         /**
          * @var string $links to save links in
          */
         $links = '';
         // create obect from Linke() Class
         $link = new Link();
         // get all languages of post translated in and get tongue name and create it in links
         foreach ($this->_valiableLang as $lang) {
             $links .= " - <a href='" . $link->create('', $lang) . "'>" . languageNameIntongue($lang) . "</a>";
         }
         return $links;
     }
 }
Example #2
0
 private function valiableLang($id = '', $table = '')
 {
     if ($id && $table) {
         $this->checkIfContentExistInCurrentLanguage($table, $id);
         if (in_array(currentLang(), $this->_valiableLang)) {
             return false;
         }
         $langs = ' (';
         foreach ($this->_valiableLang as $lang) {
             $langs .= languageNameIntongue($lang) . ' - ';
         }
         $langs = rtrim($langs, ' - ');
         $langs .= ')';
         return $langs;
     } else {
         $links = '';
         $link = new Link();
         foreach ($this->_valiableLang as $lang) {
             $links .= " - <a href='" . $link->create('', $lang) . "'>" . languageNameIntongue($lang) . "</a>";
         }
         return $links;
     }
 }
Example #3
0
    //echo $lang;
    if ($lang == 'localhost') {
        ?>
                <script type="text/javascript">
                    swal('<?php 
        __("Country Language");
        ?>
', "<?php 
        __('Cant Detect your Country Language in localhost');
        ?>
", 'error');
                </script>
                <?php 
    } else {
        ?>
                <script type="text/javascript">
                    swal("<?php 
        __('Country Language', $lang);
        ?>
", "<?php 
        echo _x('Detected Your Country Language is :', $lang) . languageNameIntongue(Detect::country());
        ?>
", "success");
                </script>
                <?php 
    }
}
?>
    </body>

</html>