From 27ae9095639bb228a1b7ff86a3ebe4264abf05be Mon Sep 17 00:00:00 2001
From: mschaefers <mschaefers@scoop-gmbh.de>
Date: Thu, 29 Nov 2012 12:33:09 -0500
Subject: [PATCH] feature: when using LdapUserService one can configure Gitblit to fetch all users from ldap that can possibly login. This allows to see newly generated LDAP users instantly in Gitblit. By now an LDAP user had to log in once to appear in GitBlit.

---
 src/com/gitblit/client/Translation.java |   52 +++++++++++++++++++++++++++-------------------------
 1 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/src/com/gitblit/client/Translation.java b/src/com/gitblit/client/Translation.java
index cd5515b..16ef20d 100644
--- a/src/com/gitblit/client/Translation.java
+++ b/src/com/gitblit/client/Translation.java
@@ -15,43 +15,45 @@
  */
 package com.gitblit.client;
 
-import java.io.InputStream;
-import java.util.Properties;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
 
+import com.gitblit.utils.TimeUtils;
+
+/**
+ * Loads the Gitblit language resource file.
+ * 
+ * @author James Moger
+ * 
+ */
 public class Translation {
 
-	private final static Properties translation;
+	private final static ResourceBundle translation;
+	
+	private final static TimeUtils timeUtils;
 
 	static {
-		translation = new Properties();
-		InputStream is = null;
+		ResourceBundle bundle;
 		try {
-			is = Translation.class.getResource("/com/gitblit/wicket/GitBlitWebApp.properties")
-					.openStream();
-		} catch (Throwable t) {
-			try {
-				is = Translation.class.getResource("/GitBlitWebApp.properties").openStream();
-			} catch (Throwable x) {
-			}
+			// development location
+			bundle = ResourceBundle.getBundle("com/gitblit/wicket/GitBlitWebApp");
+		} catch (MissingResourceException e) {
+			// runtime location
+			bundle = ResourceBundle.getBundle("GitBlitWebApp");
 		}
-		if (is != null) {
-			try {
-				translation.load(is);
-			} catch (Throwable t) {
-
-			} finally {
-				try {
-					is.close();
-				} catch (Throwable t) {
-				}
-			}
-		}
+		translation = bundle;
+		
+		timeUtils = new TimeUtils(translation);
 	}
 
 	public static String get(String key) {
 		if (translation.containsKey(key)) {
-			return translation.getProperty(key).trim();
+			return translation.getString(key).trim();
 		}
 		return key;
 	}
+	
+	public static TimeUtils getTimeUtils() {
+		return timeUtils;
+	}
 }

--
Gitblit v1.9.1