commit | author | age
|
b7f591
|
1 |
/*
|
JM |
2 |
* Copyright 2011 gitblit.com.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
package com.gitblit.client;
|
|
17 |
|
17820f
|
18 |
import java.util.MissingResourceException;
|
JM |
19 |
import java.util.ResourceBundle;
|
b7f591
|
20 |
|
17820f
|
21 |
/**
|
JM |
22 |
* Loads the Gitblit language resource file.
|
|
23 |
*
|
|
24 |
* @author James Moger
|
|
25 |
*
|
|
26 |
*/
|
b7f591
|
27 |
public class Translation {
|
JM |
28 |
|
17820f
|
29 |
private final static ResourceBundle translation;
|
b7f591
|
30 |
|
JM |
31 |
static {
|
17820f
|
32 |
ResourceBundle bundle;
|
b7f591
|
33 |
try {
|
17820f
|
34 |
// development location
|
JM |
35 |
bundle = ResourceBundle.getBundle("com/gitblit/wicket/GitBlitWebApp");
|
|
36 |
} catch (MissingResourceException e) {
|
|
37 |
// runtime location
|
|
38 |
bundle = ResourceBundle.getBundle("GitBlitWebApp");
|
b7f591
|
39 |
}
|
17820f
|
40 |
translation = bundle;
|
b7f591
|
41 |
}
|
JM |
42 |
|
|
43 |
public static String get(String key) {
|
|
44 |
if (translation.containsKey(key)) {
|
17820f
|
45 |
return translation.getString(key).trim();
|
b7f591
|
46 |
}
|
JM |
47 |
return key;
|
|
48 |
}
|
|
49 |
}
|