Lang language class
A class that designed to give answer to all aspects of language needs on the system.
It gives you the ability to manage links with multi language redirection, the class mostly controlled by lang.
The FW supports multi language and very easy to use There are few options we can use other languages: through html page or using a model that store the text.
The pages that are loaded from "view" directory set to be in the default language, configured in lang as: default. Usually that will be set as "en" but can be set as you like. The other languages configured as: available.
Let's take "contactUs" that is located under view directory for an example. Inside this directory we can create sub directory with the language name as follow: \architecture\application\views\contactUs\he. We can now create files in other languages and put it in this directory we just created. If we have the file mailSent.php located in \architecture\application\views\contactUs we can now locate mailSent.php in it's hebrew version on \architecture\application\views\contactUs\he.
Now, if we access to this page http://example.com/he/contactUs/mailSent
the page will be loaded in hebrew. If we want the default language we will use this address: http://example.com/contactUs/mailSent
, as simple as that.
currentLanguage will get the active current language key (of array), if set lang::$currentLanguage;
getCurrentLanguage will get the active current language key (of array) this::getCurrentLanguage();
setCurrentLanguage will set language this::setCurrentLanguage();
getCurrentLanguageForUrls gets the currnet language to put in url this::getCurrentLanguageForUrls();
getLanguageFromUrl get's the language code from url this::getLanguageFromUrl();
getAvailableLanguages will return array of languages this::getAvailableLanguages();
getDefaultLanguage will return the default language this::getDefaultLanguage();
url site's url creator this::url();
languageUrlStart will create start of the url given the language this::languageUrlStart();
languageUrl will create the current page url in other languages this::languageUrl();
detectLanguagesFromBrowser will detect the user languages this::detectLanguagesFromBrowser();