From d2aba8cf5c8a9b75cb51acdb5831cea9c617559f Mon Sep 17 00:00:00 2001 From: Kamesuta Date: Wed, 27 Sep 2023 03:10:49 +0900 Subject: [PATCH] separate lang file for customization --- app/app.ejs | 2 +- app/assets/js/langloader.js | 7 ++++++- app/assets/lang/_custom.toml | 20 ++++++++++++++++++++ app/assets/lang/_placeholder.toml | 13 +++++++++++++ app/assets/lang/en_US.toml | 24 +++--------------------- app/frame.ejs | 2 +- app/settings.ejs | 2 +- index.js | 2 +- 8 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 app/assets/lang/_custom.toml create mode 100644 app/assets/lang/_placeholder.toml diff --git a/app/app.ejs b/app/app.ejs index b891d586..75b5ea28 100644 --- a/app/app.ejs +++ b/app/app.ejs @@ -1,7 +1,7 @@ - Helios Launcher + <%= lang('app.title') %> diff --git a/app/assets/js/langloader.js b/app/assets/js/langloader.js index c023aed6..38a0a6b5 100644 --- a/app/assets/js/langloader.js +++ b/app/assets/js/langloader.js @@ -33,9 +33,14 @@ exports.queryEJS = function(id, placeHolders){ } exports.setupLanguage = function(){ + // Load a Placeholder Language File for texts that do not require translation + exports.loadLanguage('_placeholder') + // Load Language Files exports.loadLanguage('en_US') - // Uncomment this when translations are ready //exports.loadLanguage('xx_XX') + + // Load Custom Language File for Launcher Customizer + exports.loadLanguage('_custom') } \ No newline at end of file diff --git a/app/assets/lang/_custom.toml b/app/assets/lang/_custom.toml new file mode 100644 index 00000000..da17faf9 --- /dev/null +++ b/app/assets/lang/_custom.toml @@ -0,0 +1,20 @@ +# Custom Language File for Launcher Customizer + +[ejs.app] +title = "Helios Launcher" + +[ejs.landing] +mediaGitHubURL = "https://github.com/dscalzi/HeliosLauncher" +mediaTwitterURL = "#" +mediaInstagramURL = "#" +mediaYouTubeURL = "#" +mediaDiscordURL = "https://discord.gg/zNWUXdt" + +[ejs.settings] +sourceGithubLink = "https://github.com/dscalZi/HeliosLauncher" +supportLink = "https://github.com/dscalZi/HeliosLauncher/issues" + +[ejs.welcome] +welcomeHeader = "WELCOME TO WESTEROSCRAFT" +welcomeDescription = "Our mission is to recreate the universe imagined by author George RR Martin in his fantasy series, A Song of Ice and Fire. Through the collaborative effort of thousands of community members, we have sought to create Westeros as accurately and precisely as possible within Minecraft. The world we are creating is yours to explore. Journey from Dorne to Castle Black, and if you aren’t afraid, beyond the Wall itself, but best not delay. As the words of House Stark ominously warn: Winter is Coming." +welcomeDescCTA = "You are just a few clicks away from Westeros." diff --git a/app/assets/lang/_placeholder.toml b/app/assets/lang/_placeholder.toml new file mode 100644 index 00000000..4ac7167a --- /dev/null +++ b/app/assets/lang/_placeholder.toml @@ -0,0 +1,13 @@ +# Placeholder Language File for texts that do not require translation + +[ejs.landing] +newsArticleTitle = "Lorem Ipsum" +newsArticleDate = "Mar 15, 44 BC, 9:14 AM" +newsArticleAuthor = "by Cicero" +newsArticleComments = "0 Comments" + +[ejs.overlay] +overlayTitle = "Lorem Ipsum:
Finis Illud" +overlayDesc = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.." +overlayAcknowledge = "Conare Iterum" +overlayDismiss = "Dismiss" diff --git a/app/assets/lang/en_US.toml b/app/assets/lang/en_US.toml index 397db6c7..2d291b50 100644 --- a/app/assets/lang/en_US.toml +++ b/app/assets/lang/en_US.toml @@ -3,11 +3,6 @@ updateAvailableTooltip = "Update Available" usernamePlaceholder = "Username" usernameEditButton = "Edit" settingsTooltip = "Settings" -mediaGitHubURL = "https://github.com/dscalzi/HeliosLauncher" -mediaTwitterURL = "#" -mediaInstagramURL = "#" -mediaYouTubeURL = "#" -mediaDiscordURL = "https://discord.gg/zNWUXdt" serverStatus = "SERVER" serverStatusPlaceholder = "OFFLINE" mojangStatus = "MOJANG STATUS" @@ -19,10 +14,6 @@ launchButton = "PLAY" launchButtonPlaceholder = "• No Server Selected" launchProgressLabel = "0%" launchDetails = "Please wait.." -newsArticleTitle = "Lorem Ipsum" -newsArticleDate = "Mar 15, 44 BC, 9:14 AM" -newsArticleAuthor = "by Cicero" -newsArticleComments = "0 Comments" newsNavigationStatus = "1 of 1" newsErrorLoadSpan = "Checking for News.." newsErrorFailedSpan = "Failed to Load News" @@ -44,7 +35,7 @@ loginButtonText = "LOGIN" loginNeedAccountLink = "https://minecraft.net/store/minecraft-java-edition/" loginNeedAccountText = "Need an Account?" loginPasswordDisclaimer1 = "Your password is sent directly to mojang and never stored." -loginPasswordDisclaimer2 = "Helios Launcher is not affiliated with Mojang AB." +loginPasswordDisclaimer2 = "<%= lang('app.title') %> is not affiliated with Mojang AB." [ejs.loginOptions] loginOptionsTitle = "Login Options" @@ -59,10 +50,6 @@ serverSelectCancel = "Cancel" accountSelectHeader = "Select an Account" accountSelectConfirm = "Select" accountSelectCancel = "Cancel" -overlayTitle = "Lorem Ipsum:
Finis Illud" -overlayDesc = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.." -overlayAcknowledge = "Conare Iterum" -overlayDismiss = "Dismiss" [ejs.settings] navHeaderText = "Settings" @@ -132,16 +119,14 @@ chooseFolder = "Choose Folder" dataDirectoryDesc = "All game files and local Java installations will be stored in the data directory.
Screenshots and world saves are stored in the instance folder for the corresponding server configuration." aboutTabHeaderText = "About" aboutTabHeaderDesc = "View information and release notes for the current version." -aboutTitle = "Helios Launcher" +aboutTitle = "<%= lang('app.title') %>" aboutCurrentVersionCheck = "Stable Release" versionCheck = "✓" stableRelease = "Stable Release" versionText = "Version " versionValue = "0.0.1-alpha.18" sourceGithub = "Source (GitHub)" -sourceGithubLink = "https://github.com/dscalZi/HeliosLauncher" support = "Support" -supportLink = "https://github.com/dscalZi/HeliosLauncher/issues" devToolsConsole = "DevTools Console" releaseNotes = "Release Notes" changelog = "Changelog" @@ -158,9 +143,6 @@ updateReleaseNotes = "Update Release Notes" waitingText = "Waiting for Microsoft.." [ejs.welcome] -welcomeHeader = "WELCOME TO WESTEROSCRAFT" -welcomeDescription = "Our mission is to recreate the universe imagined by author George RR Martin in his fantasy series, A Song of Ice and Fire. Through the collaborative effort of thousands of community members, we have sought to create Westeros as accurately and precisely as possible within Minecraft. The world we are creating is yours to explore. Journey from Dorne to Castle Black, and if you aren’t afraid, beyond the Wall itself, but best not delay. As the words of House Stark ominously warn: Winter is Coming." -welcomeDescCTA = "You are just a few clicks away from Westeros." continueButton = "CONTINUE" @@ -203,7 +185,7 @@ players = "PLAYERS" [js.landing.systemScan] checking = "Checking system info.." noCompatibleJava = "No Compatible
Java Installation Found" -installJavaMessage = "In order to join WesterosCraft, you need a 64-bit installation of Java {major}. Would you like us to install a copy?" +installJavaMessage = "In order to launch Minecraft, you need a 64-bit installation of Java {major}. Would you like us to install a copy?" installJava = "Install Java" installJavaManually = "Install Manually" javaDownloadPrepare = "Preparing Java Download.." diff --git a/app/frame.ejs b/app/frame.ejs index c2aaf337..1151f915 100644 --- a/app/frame.ejs +++ b/app/frame.ejs @@ -13,7 +13,7 @@ <% } else{ %>
- Helios Launcher + <%= lang('app.title') %>
-
<%- lang('settings.jvmOptsDesc') %>
<%- evalEjs(lang('settings.jvmOptsLinkText')) %>
+
<%- lang('settings.jvmOptsDesc') %>
<%- lang('settings.jvmOptsLinkText') %>