-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
145 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { locale as getLocale } from '@tauri-apps/api/os'; | ||
import { langs } from './lang'; | ||
|
||
let locale = navigator.language.split('-')[0]; | ||
const defaultLocale = "en"; | ||
|
||
getLocale().then(systemLocale => { | ||
if (systemLocale) | ||
locale = systemLocale.split('-')[0] | ||
}) | ||
|
||
export function trans(id: string, data?: Record<string, string | number | undefined>) { | ||
if (locale && langs[locale] && langs[locale][id]) { | ||
const text = langs[locale][id]; | ||
for (const key in data) { | ||
if (Object.prototype.hasOwnProperty.call(data, key)) { | ||
const element = data[key]; | ||
if (element !== undefined) | ||
text.replaceAll(`{{${key}}}`, element.toString()) | ||
} | ||
} | ||
return text | ||
} | ||
if (langs[defaultLocale] && langs[defaultLocale][id]) { | ||
const text = langs[defaultLocale][id]; | ||
for (const key in data) { | ||
if (Object.prototype.hasOwnProperty.call(data, key)) { | ||
const element = data[key]; | ||
if (element !== undefined) | ||
text.replaceAll(`{{${key}}}`, element.toString()) | ||
} | ||
} | ||
return text | ||
} | ||
return id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"progress.clean_old": "Cleaning up old files", | ||
"progress.load_pack": "Downloading modpack", | ||
"progress.download_files": "Downloading mods", | ||
"progress.download_file": "Downloading {{file}} ({{idx}}/{{total}})", | ||
"progress.extract_overrides": "Extracting configuration files", | ||
"progress.install_loader": "Installing mod loader", | ||
"progress.add_profile": "Creating launcher profile", | ||
"ui.loading-versions": "Loading versions...", | ||
"ui.version-tooltip": "Vanilla Installer allows easy installation of all supported versions of Fabulously Optimized. For outdated versions, use a different launcher.", | ||
"ui.isolate-profile": "Use a different <code class=\"inline-code\">.minecraft</code> directory for this version?", | ||
"ui.profile-dir-placeholder": "Leave blank to let the installer decide", | ||
"ui.profile-dir-browse-label": "Browse folders", | ||
"ui.install-button": "Install!", | ||
"ui.installing": "Installing...", | ||
"ui.installed": "Fabulously Optimized is installed!", | ||
"ui.install-error": "An error occurred while installing Fabulously Optimized: {{errorMessage}}", | ||
"ui.downgrade-msg": "You are attempting to downgrade the Minecraft version. This is <span class=\"inline font-semibold\">NOT SUPPORTED</span> by Mojang or Fabulously Optimized and it may cause world corruption or crashes. <br /> If you want to do this safely, you should backup <code class=\"inline-code\">mods</code>, <code class=\"inline-code\">config</code> and <code class=\"inline-code\">saves</code> folders to a different location and delete them from your .minecraft folder.<br /> To skip this warning after backing up the folders, delete <code class=\"inline-code\">paigaldaja_meta.json</code> from your .minecraft folder.", | ||
"ui.confirm-downgrade": "Yes, I want to downgrade FO.", | ||
"ui.downgrade-cancel": "Back", | ||
"ui.downgrade-continue": "Continue", | ||
"ui.confirm-exit": "Fabulously Optimized is installing. Are you sure you want to exit?" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import en from "./en.json"; | ||
|
||
export const langs: Record<string, Record<string, string>> = { | ||
en | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters