Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello, i have a question:

How can i reade and localise data from lang files outside of jar?

1)I have a folder, where user creates lang files (named as usual (en_US for example)), and localizes some of names there using common pattern (a.name=A)

2) I think this is the best way for my case: User can create new types of items via json, and in order for name not to be m.d.name, i would like to make him able to localize  names in this folder in these files...

3) I googled and searched on this forum with no results :(

4) I tryed to use this code, but it is not working:

	File lang = new File(configFolder, "lang");
	lang.mkdirs();

	for(File file : lang.listFiles(new FileFilter() {
		@Override
		public boolean accept(File file) {
			return !file.isDirectory() && file.getName().endsWith(".lang");
		}
	})){
		try{
			String language = file.getName().split("/.")[0];
			HashMap<String, String> map = new HashMap<String, String>();

			BufferedReader br = new BufferedReader(new FileReader(file)) ;

			for(String line; (line = br.readLine()) != null; ) {
				try{
					map.put(line.split("/=")[0], line.split("/=")[1]);
				} catch(IndexOutOfBoundsException e){

				}
			}

			br.close();

			LanguageRegistry.instance().injectLanguage(language, map);
		} catch(Exception e){
			logger.error("Caught exception while parsing lang file: ", e);
		}
	}
[code]
4.1) I know thatparsing is going well. (tested via console output).

Thanks for help!
If you have any questions - just ask!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.