From 9e877dfb12a27351b6062af8bf9cc2078b4939ac Mon Sep 17 00:00:00 2001
From: alexytomi <60690056+alexytomi@users.noreply.github.com>
Date: Sat, 21 Jun 2025 00:00:41 +0800
Subject: [PATCH] fix[i18n]: Add localization
---
.../java/net/kdt/pojavlaunch/LauncherActivity.java | 2 +-
.../src/main/java/net/kdt/pojavlaunch/Tools.java | 4 ++--
.../kdt/pojavlaunch/fragments/MainMenuFragment.java | 12 ++++++------
app_pojavlauncher/src/main/res/values/strings.xml | 5 +++++
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/LauncherActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/LauncherActivity.java
index 26d01c6c4..a3c296523 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/LauncherActivity.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/LauncherActivity.java
@@ -141,7 +141,7 @@ public class LauncherActivity extends BaseActivity {
}
if (isOlderThan13) {
- hasNoOnlineProfileDialog(this, getString(R.string.global_error), "This version is not available in demo mode.");
+ hasNoOnlineProfileDialog(this, getString(R.string.global_error), getString(R.string.demo_versions_supported));
return false;
}
}
diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java
index 8ae348bce..24acb1ef1 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java
@@ -1463,7 +1463,7 @@ public final class Tools {
}
public static void hasNoOnlineProfileDialog(Activity activity){
if (hasOnlineProfile()){
- } else dialogOnUiThread(activity, "No Minecraft Account Found", "Please log into your Minecraft: Java Edition account to use this feature.");
+ } else dialogOnUiThread(activity, activity.getString(R.string.no_minecraft_account_found), activity.getString(R.string.feature_requires_java_account));
}
public static void hasNoOnlineProfileDialog(Activity activity, String customTitle, String customMessage){
if (hasOnlineProfile()){
@@ -1472,7 +1472,7 @@ public final class Tools {
public static void hasNoOnlineProfileDialog(Activity activity, Runnable run){
if (hasOnlineProfile()){
run.run();
- } else dialogOnUiThread(activity, "No Minecraft Account Found", "Please log into your Minecraft: Java Edition account to use this feature.");
+ } else dialogOnUiThread(activity, activity.getString(R.string.no_minecraft_account_found), activity.getString(R.string.feature_requires_java_account));
}
public static void hasNoOnlineProfileDialog(Activity activity, Runnable run, String customTitle, String customMessage){
if (hasOnlineProfile()){
diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/fragments/MainMenuFragment.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/fragments/MainMenuFragment.java
index a029d82c3..ee59d87e4 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/fragments/MainMenuFragment.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/fragments/MainMenuFragment.java
@@ -69,12 +69,12 @@ public class MainMenuFragment extends Fragment {
mShareLogsButton.setOnClickListener((v) -> shareLog(requireContext()));
mOpenDirectoryButton.setOnClickListener((v)-> {
- if (hasOnlineProfile()) {
- if (Tools.isDemoProfile(v.getContext())){
- hasNoOnlineProfileDialog(getActivity(), "Demo Profile not supported", "Please change accounts to use this function");
- }
- openPath(v.getContext(), getCurrentProfileDirectory(), false);
- } else hasNoOnlineProfileDialog(requireActivity());
+ if (Tools.isDemoProfile(v.getContext())){ // Say a different message when on demo profile since they might see the hidden demo folder
+ hasNoOnlineProfileDialog(getActivity(), getString(R.string.demo_unsupported), getString(R.string.change_account));
+ } else if (!hasOnlineProfile()) { // Otherwise display the generic pop-up to log in
+ hasNoOnlineProfileDialog(requireActivity());
+ } else openPath(v.getContext(), getCurrentProfileDirectory(), false);
+
});
diff --git a/app_pojavlauncher/src/main/res/values/strings.xml b/app_pojavlauncher/src/main/res/values/strings.xml
index 369ee49aa..8e2fe4f52 100644
--- a/app_pojavlauncher/src/main/res/values/strings.xml
+++ b/app_pojavlauncher/src/main/res/values/strings.xml
@@ -445,4 +445,9 @@
May help with shaderpack glitches. Disable if not needed, can cause crashes.
Error Filtering
Amethyst
+ Only Vanilla 1.3.1 and above are supported on demo accounts
+ Demo Profile not supported
+ Please change accounts to use this function
+ No Minecraft Account Found
+ This feature requires a Microsoft account that owns Minecraft Java Edition.