summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/gitblit/wicket/GitBlitWebAppResourceBundleTest.java
blob: 05549d16f764f1bebf8692c5b531b14be0ff4d52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package com.gitblit.wicket;

import org.junit.Test;

import java.util.Locale;
import java.util.ResourceBundle;

import static org.junit.Assert.*;

public class GitBlitWebAppResourceBundleTest
{
    @Test
    public void testDefaultResource()
    {
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp");
        assertNotNull(bundle);
        assertEquals("default", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testCsResource()
    {
        Locale l = Locale.forLanguageTag("cs");
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("čeština", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testDeResource()
    {
        Locale l = Locale.GERMAN;
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("Deutsch", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testEnResource()
    {
        Locale l = Locale.ENGLISH;
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        // The "en" file is just a placeholder for the default one.
        assertEquals("default", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testEsResource()
    {
        Locale l = Locale.forLanguageTag("es");
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("Español", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testFrResource() throws Exception
    {
        Locale l = Locale.FRENCH;
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("français", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testItResource() throws Exception
    {
        Locale l = Locale.ITALIAN;
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("Italiano", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testJaResource() throws Exception
    {
        Locale l = Locale.JAPANESE;
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("にほんご", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testKoResource() throws Exception
    {
        Locale l = Locale.KOREAN;
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("한국어", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testNlResource() throws Exception
    {
        Locale l = Locale.forLanguageTag("nl");
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("Nederlands", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testNoResource() throws Exception
    {
        Locale l = Locale.forLanguageTag("no");
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("Norsk", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testPlResource() throws Exception
    {
        Locale l = Locale.forLanguageTag("pl");
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("polszczyzna", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testPtBrResource() throws Exception
    {
        Locale l = Locale.forLanguageTag("pt-BR");
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("Português", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testZhCnResource() throws Exception
    {
        Locale l = Locale.SIMPLIFIED_CHINESE;
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("汉字", bundle.getString("gb.loadLang"));
    }

    @Test
    public void testZhTwResource() throws Exception
    {
        Locale l = Locale.TRADITIONAL_CHINESE;
        ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
        assertNotNull(bundle);
        assertEquals("漢字", bundle.getString("gb.loadLang"));
    }
}