Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
982 | daniel-mar | 1 | /* |
2 | * OIDplus 2.0 |
||
3 | * Copyright 2019 - 2022 Daniel Marschall, ViaThinkSoft |
||
4 | * |
||
5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
6 | * you may not use this file except in compliance with the License. |
||
7 | * You may obtain a copy of the License at |
||
8 | * |
||
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
10 | * |
||
11 | * Unless required by applicable law or agreed to in writing, software |
||
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
14 | * See the License for the specific language governing permissions and |
||
15 | * limitations under the License. |
||
16 | */ |
||
17 | |||
18 | function _L() { |
||
19 | var args = Array.prototype.slice.call(arguments); |
||
20 | var str = args.shift().trim(); |
||
21 | |||
22 | var tmp = ""; |
||
23 | if (typeof language_messages[getCurrentLang()] == 'undefined') { // do not translate |
||
24 | tmp = str; |
||
25 | } else { |
||
26 | var msg = language_messages[getCurrentLang()][str]; |
||
27 | if (typeof msg != 'undefined') { // do not translate |
||
28 | tmp = msg; |
||
29 | } else { |
||
30 | tmp = str; |
||
31 | } |
||
32 | } |
||
33 | |||
34 | tmp = tmp.replace('###', language_tblprefix); |
||
35 | |||
36 | var n = 1; |
||
37 | while (args.length > 0) { |
||
38 | var val = args.shift(); |
||
39 | tmp = tmp.replace("%"+n, val); |
||
40 | n++; |
||
41 | } |
||
42 | |||
43 | tmp = tmp.replace("%%", "%"); |
||
44 | |||
45 | return tmp; |
||
46 | } |
||
47 | |||
48 | function getCurrentLang() { |
||
49 | // Note: If the argument "?lang=" is used, PHP will automatically set a Cookie, so it is OK when we only check for the cookie |
||
50 | var lang = getCookie('LANGUAGE'); // do not translate |
||
51 | return (typeof lang != 'undefined') ? lang : DEFAULT_LANGUAGE; // do not translate |
||
52 | } |
||
53 | |||
54 | // Note: setLanguage() is defined in includes/oidplus_base.js, because only the |
||
55 | // main application supports language changing via JavaScript. Setup just |
||
56 | // reloads the page. |
||
57 |