AC_4897, AC_4898, AC_4899: Multifile uploader fixes.
[acontent.git] / include / classes / Language / LanguageUtility.class.php
1 <?php\r
2 /************************************************************************/\r
3 /* AContent                                                             */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2010                                                   */\r
6 /* Inclusive Design Institute                                           */\r
7 /*                                                                      */\r
8 /* This program is free software. You can redistribute it and/or        */\r
9 /* modify it under the terms of the GNU General Public License          */\r
10 /* as published by the Free Software Foundation.                        */\r
11 /************************************************************************/\r
12 \r
13 /**\r
14 * Utility functions for language \r
15 * @access       public\r
16 * @author       Cindy Qi Li\r
17 */\r
18 \r
19 if (!defined('TR_INCLUDE_PATH')) exit;\r
20 \r
21 class LanguageUtility {\r
22 \r
23         /**\r
24         * return language code from given AContent  language code\r
25         * @access  public\r
26         * @param   $code\r
27         * @return  language code\r
28         * @author  Cindy Qi Li\r
29         */\r
30         public static function getParentCode($code = '') {\r
31                 if (!$code && isset($this)) {\r
32                         $code = $this->code;\r
33                 }\r
34                 $peices = explode(TR_LANGUAGE_LOCALE_SEP, $code, 2);\r
35                 return $peices[0];\r
36         }\r
37 \r
38         /**\r
39         * return charset from given AContent  language code\r
40         * @access  public\r
41         * @param   $code\r
42         * @return  charset\r
43         * @author  Cindy Qi Li\r
44         */\r
45         public static function getLocale($code = '') {\r
46                 if (!$code && isset($this)) {\r
47                         $code = $this->code;\r
48                 }\r
49                 $peices = explode(TR_LANGUAGE_LOCALE_SEP, $code, 2);\r
50                 return $peices[1];\r
51         }\r
52 }\r
53 ?>\r