Skip to content

Instantly share code, notes, and snippets.

@mitsugu
Last active February 17, 2024 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitsugu/f790ef5c0ace3ef1863819929f784251 to your computer and use it in GitHub Desktop.
Save mitsugu/f790ef5c0ace3ef1863819929f784251 to your computer and use it in GitHub Desktop.
抜粋。
public LoadTextMainMenuBar() {
try {
// これではどうも resource ディレクトリの子供のディレクトリにはアクセスできないっぽい。
// jar ファイルの外のディレクトリにはアクセスできる。
File dicDir = Paths.get("src/main/resource/l18n").toFile();
URLClassLoader urlLoader = new URLClassLoader(new URL[]{dicDir.toURI().toURL()});
ResourceBundle rb;
rb = ResourceBundle.getBundle("RBMenu",Locale.getDefault(), urlLoader);
hmResult = new HashMap<String, String>();
hmResult.put("DISTRIBUTION", rb.getString("DISTRIBUTION.text"));
hmResult.put("GRID_SIZE", rb.getString("GRID_SIZE.text"));
hmResult.put("ABORT", rb.getString("ABORT.text"));
hmResult.put("GAME", rb.getString("GAME.text"));
hmResult.put("NEW_ROUND", rb.getString("NEW_ROUND.text"));
hmResult.put("OPTIONS", rb.getString("OPTIONS.text"));
hmResult.put("PLAYER_SETTINGS", rb.getString("PLAYER_SETTINGS.text"));
hmResult.put("VIEW", rb.getString("VIEW.text"));
hmResult.put("ABOUT", rb.getString("ABOUT.text"));
} catch(MalformedURLException e) {
System.out.println(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment