ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilMDLanguageElement.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 /*
5  +-----------------------------------------------------------------------------+
6  | ILIAS open source |
7  +-----------------------------------------------------------------------------+
8  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
9  | |
10  | This program is free software; you can redistribute it and/or |
11  | modify it under the terms of the GNU General Public License |
12  | as published by the Free Software Foundation; either version 2 |
13  | of the License, or (at your option) any later version. |
14  | |
15  | This program is distributed in the hope that it will be useful, |
16  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18  | GNU General Public License for more details. |
19  | |
20  | You should have received a copy of the GNU General Public License |
21  | along with this program; if not, write to the Free Software |
22  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23  +-----------------------------------------------------------------------------+
24 */
25 
33 {
34  protected string $language_code;
35  protected array $possible_language_codes;
36 
37  public function __construct(string $a_code)
38  {
39  $this->language_code = $a_code;
40 
41  $this->possible_language_codes = array(
42  "aa",
43  "ab",
44  "af",
45  "am",
46  "ar",
47  "as",
48  "ay",
49  "az",
50  "ba",
51  "be",
52  "bg",
53  "bh",
54  "bi",
55  "bn",
56  "bo",
57  "br",
58  "ca",
59  "co",
60  "cs",
61  "cy",
62  "da",
63  "de",
64  "dz",
65  "el",
66  "en",
67  "eo",
68  "es",
69  "et",
70  "eu",
71  "fa",
72  "fi",
73  "fj",
74  "fo",
75  "fr",
76  "fy",
77  "ga",
78  "gd",
79  "gl",
80  "gn",
81  "gu",
82  "ha",
83  "he",
84  "hi",
85  "hr",
86  "hu",
87  "hy",
88  "ia",
89  "ie",
90  "ik",
91  "id",
92  "is",
93  "it",
94  "iu",
95  "ja",
96  "jv",
97  "ka",
98  "kk",
99  "kl",
100  "km",
101  "kn",
102  "ko",
103  "ks",
104  "ku",
105  "ky",
106  "la",
107  "ln",
108  "lo",
109  "lt",
110  "lv",
111  "mg",
112  "mi",
113  "mk",
114  "ml",
115  "mn",
116  "mo",
117  "mr",
118  "ms",
119  "mt",
120  "my",
121  "na",
122  "ne",
123  "nl",
124  "no",
125  "oc",
126  "om",
127  "or",
128  "pa",
129  "pl",
130  "ps",
131  "pt",
132  "qu",
133  "rm",
134  "rn",
135  "ro",
136  "ru",
137  "rw",
138  "sa",
139  "sd",
140  "sg",
141  "sh",
142  "si",
143  "sk",
144  "sl",
145  "sm",
146  "sn",
147  "so",
148  "sq",
149  "sr",
150  "ss",
151  "st",
152  "su",
153  "sv",
154  "sw",
155  "ta",
156  "te",
157  "tg",
158  "th",
159  "ti",
160  "tk",
161  "tl",
162  "tn",
163  "to",
164  "tr",
165  "ts",
166  "tt",
167  "tw",
168  "ug",
169  "uk",
170  "ur",
171  "uz",
172  "vi",
173  "vo",
174  "wo",
175  "xh",
176  "yi",
177  "yo",
178  "za",
179  "zh",
180  "zu"
181  );
182  }
183 
184  public function getLanguageCode(): string
185  {
186  if (in_array($this->language_code, $this->possible_language_codes, true)) {
187  return $this->language_code;
188  }
189  return '';
190  }
191 }