You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GitBlitWebAppResourceBundleTest.java 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. package com.gitblit.wicket;
  2. import org.junit.Test;
  3. import java.util.Locale;
  4. import java.util.ResourceBundle;
  5. import static org.junit.Assert.*;
  6. public class GitBlitWebAppResourceBundleTest
  7. {
  8. @Test
  9. public void testDefaultResource()
  10. {
  11. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp");
  12. assertNotNull(bundle);
  13. assertEquals("default", bundle.getString("gb.loadLang"));
  14. }
  15. @Test
  16. public void testCsResource()
  17. {
  18. Locale l = Locale.forLanguageTag("cs");
  19. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  20. assertNotNull(bundle);
  21. assertEquals("čeština", bundle.getString("gb.loadLang"));
  22. }
  23. @Test
  24. public void testDeResource()
  25. {
  26. Locale l = Locale.GERMAN;
  27. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  28. assertNotNull(bundle);
  29. assertEquals("Deutsch", bundle.getString("gb.loadLang"));
  30. }
  31. @Test
  32. public void testEnResource()
  33. {
  34. Locale l = Locale.ENGLISH;
  35. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  36. assertNotNull(bundle);
  37. // The "en" file is just a placeholder for the default one.
  38. assertEquals("default", bundle.getString("gb.loadLang"));
  39. }
  40. @Test
  41. public void testEsResource()
  42. {
  43. Locale l = Locale.forLanguageTag("es");
  44. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  45. assertNotNull(bundle);
  46. assertEquals("Español", bundle.getString("gb.loadLang"));
  47. }
  48. @Test
  49. public void testFrResource() throws Exception
  50. {
  51. Locale l = Locale.FRENCH;
  52. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  53. assertNotNull(bundle);
  54. assertEquals("français", bundle.getString("gb.loadLang"));
  55. }
  56. @Test
  57. public void testItResource() throws Exception
  58. {
  59. Locale l = Locale.ITALIAN;
  60. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  61. assertNotNull(bundle);
  62. assertEquals("Italiano", bundle.getString("gb.loadLang"));
  63. }
  64. @Test
  65. public void testJaResource() throws Exception
  66. {
  67. Locale l = Locale.JAPANESE;
  68. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  69. assertNotNull(bundle);
  70. assertEquals("にほんご", bundle.getString("gb.loadLang"));
  71. }
  72. @Test
  73. public void testKoResource() throws Exception
  74. {
  75. Locale l = Locale.KOREAN;
  76. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  77. assertNotNull(bundle);
  78. assertEquals("한국어", bundle.getString("gb.loadLang"));
  79. }
  80. @Test
  81. public void testNlResource() throws Exception
  82. {
  83. Locale l = Locale.forLanguageTag("nl");
  84. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  85. assertNotNull(bundle);
  86. assertEquals("Nederlands", bundle.getString("gb.loadLang"));
  87. }
  88. @Test
  89. public void testNoResource() throws Exception
  90. {
  91. Locale l = Locale.forLanguageTag("no");
  92. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  93. assertNotNull(bundle);
  94. assertEquals("Norsk", bundle.getString("gb.loadLang"));
  95. }
  96. @Test
  97. public void testPlResource() throws Exception
  98. {
  99. Locale l = Locale.forLanguageTag("pl");
  100. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  101. assertNotNull(bundle);
  102. assertEquals("polszczyzna", bundle.getString("gb.loadLang"));
  103. }
  104. @Test
  105. public void testPtBrResource() throws Exception
  106. {
  107. Locale l = Locale.forLanguageTag("pt-BR");
  108. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  109. assertNotNull(bundle);
  110. assertEquals("Português", bundle.getString("gb.loadLang"));
  111. }
  112. @Test
  113. public void testZhCnResource() throws Exception
  114. {
  115. Locale l = Locale.SIMPLIFIED_CHINESE;
  116. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  117. assertNotNull(bundle);
  118. assertEquals("汉字", bundle.getString("gb.loadLang"));
  119. }
  120. @Test
  121. public void testZhTwResource() throws Exception
  122. {
  123. Locale l = Locale.TRADITIONAL_CHINESE;
  124. ResourceBundle bundle = ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp", l);
  125. assertNotNull(bundle);
  126. assertEquals("漢字", bundle.getString("gb.loadLang"));
  127. }
  128. }