BrightSide Workbench Full Report + Source Code
ElLabel.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2013 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.elephant.zkoss;
20 
21 import java.util.Locale;
22 import java.util.Map;
23 import org.turro.elephant.context.Application;
24 import org.turro.i18n.I_;
25 
30 @Deprecated
31 public class ElLabel {
32 
33  public static String getLabel(String key) {
34  return I_.get(key);
35 // if(key != null) {
36 // LabelsMap map = Labels.getMap(Application.BUNDLES, org.zkoss.util.Locales.getCurrent());
37 // return (String) map.get(key);
38 // }
39 // return key;
40  }
41 
42  public static Map getMap() {
43  return Application.getStringMap();
44 // return Labels.getMap(Application.BUNDLES, org.zkoss.util.Locales.getCurrent());
45  }
46 
47  public static String getLabel(String key, Locale locale) {
48  return Application.getString(key, locale);
49 // if(key != null) {
50 // LabelsMap map = Labels.getMap(Application.BUNDLES, validLocale(locale));
51 // return (String) map.get(key);
52 // }
53 // return key;
54  }
55 
56  public static String getLabel(String key, Object[] args) {
57  return Application.getStringPars(key, args);
58 // String label = getLabel(key);
59 // return label != null ? new MessageFormat(label, org.zkoss.util.Locales.getCurrent()).format(args) : null;
60  }
61 
62  public static String getLabel(String key, Locale locale, Object[] args) {
63  return Application.getStringPars(key, locale, args);
64 // String label = getLabel(key, locale);
65 // return label != null ? new MessageFormat(label, validLocale(locale)).format(args) : null;
66  }
67 
68 // private static Locale validLocale(Locale locale) {
69 // return getLocales().isValid(locale) ? locale : org.zkoss.util.Locales.getCurrent();
70 // }
71 //
72 // private static Locales _locales;
73 //
74 // private static Locales getLocales() {
75 // if(_locales == null) {
76 // _locales = new Locales();
77 // for(String s : ElephantContext.getSiteLocales().split(" *, *")) {
78 // _locales.addPreferred(s);
79 // }
80 // }
81 // return _locales;
82 // }
83 
84  private ElLabel() {
85  }
86 
87 }
static String getStringPars(String key, Object... args)
static String getString(String key)
static String getLabel(String key)
Definition: ElLabel.java:33
static String getLabel(String key, Object[] args)
Definition: ElLabel.java:56
static String getLabel(String key, Locale locale)
Definition: ElLabel.java:47
static String getLabel(String key, Locale locale, Object[] args)
Definition: ElLabel.java:62
static String get(String msg)
Definition: I_.java:41