Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Indonesian translation #2018

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions jadx-gui/src/main/java/jadx/gui/utils/NLS.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package jadx.gui.utils;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
Expand Down Expand Up @@ -39,6 +38,7 @@ public class NLS {
LANG_LOCALES.add(new LangLocale("ko", "KR"));
LANG_LOCALES.add(new LangLocale("pt", "BR"));
LANG_LOCALES.add(new LangLocale("ru", "RU"));
LANG_LOCALES.add(new LangLocale("id", "ID"));

LANG_LOCALES.forEach(NLS::load);

Expand All @@ -50,20 +50,20 @@ public class NLS {
private NLS() {
}

private static void load(LangLocale locale) {
ResourceBundle bundle;
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
String resName = String.format("i18n/Messages_%s.properties", locale.get());
URL bundleUrl = classLoader.getResource(resName);
private static void load(LangLocale lang) {
Locale locale = lang.get();
String resName = String.format("i18n/Messages_%s.properties", locale.toLanguageTag().replace('-', '_'));
URL bundleUrl = NLS.class.getClassLoader().getResource(resName);
if (bundleUrl == null) {
throw new JadxRuntimeException("Locale resource not found: " + resName);
}
ResourceBundle bundle;
try (Reader reader = new InputStreamReader(bundleUrl.openStream(), StandardCharsets.UTF_8)) {
bundle = new PropertyResourceBundle(reader);
} catch (IOException e) {
} catch (Exception e) {
throw new JadxRuntimeException("Failed to load " + resName, e);
}
LANG_LOCALES_MAP.put(locale, bundle);
LANG_LOCALES_MAP.put(lang, bundle);
}

public static String str(String key) {
Expand Down
Loading