Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- return array(
- 'index' => 'Homepage',
- 'feedback' => 'Feedback'
- 'logout' => 'Logout from profile',
- )
- ?>
- <?php
- return array(
- 'logout' => 'Выйти из профиля',
- )
- ?>
- $lang = include('lang/en.php');
- if(isset($_GET['lang']))
- {
- $lang = array_merge($lang, include('lang/ru.php'));
- }
- Array
- (
- [index] => Homepage
- [feedback] => Feedback
- [logout] => Выйти из профиля
- )
- function __($name) {
- global $lang;
- return $lang[$name];
- }
- ...
- <title><?=__('index')?></title>
- </head>
- <body>
- <?=__('feedback')?>
- $file = file_get_contents("/path/to/file");
- $lines = explode('r', $file);
- foreach($lines as $line) $message[substr($line, 0, strpos($line, ','))] = substr($line, strpos($line, ','));
- 1,The site is down.
- 2,Try again.
- 3,No soup for you!
- 4,Signs point to yes.
- $defaultLang = array('Home','Logout',etc)
- $otherLang=array( 'ru' => array('Home_in_ru','logout_in_ru',etc);
- echo translate('Home');
- function translate($msg) {
- if ($_GET['lang']=='en')
- return $msg;
- return $otherLang[$_GET['lang']][array_search($msg,$defaultLang)];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement