package com.microfocus.g11n.openl10n.utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Properties; /** * Created by bux on 2018/1/28. */ public class Localization { private static final String L_STRING_FILE = "lStrings.properties"; private static final Logger logger = LoggerFactory.getLogger(Localization.class); private static Properties prop = new Properties(); public static String getString(String key){ try { if (prop.isEmpty()) { prop.load(Localization.class.getClassLoader().getResourceAsStream(L_STRING_FILE)); } return prop.getProperty(key); } catch (Exception ex) { logger.error("Load localization file error.", ex); return ""; } } }