mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
Locale setting implemented. Has numeral error when switching locales
This commit is contained in:
parent
0229eda9ce
commit
5635b51659
40
index.html
40
index.html
@ -926,7 +926,7 @@
|
||||
<!-- Suppress faction invites -->
|
||||
<fieldset>
|
||||
<label for="settingsSuppressFactionInvites" class="tooltip">Suppress Faction Invites:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, then any faction invites you receive will not appear as popups
|
||||
on the screen. Your outstanding faction invites can be viewed in the 'Factions' page.
|
||||
</span>
|
||||
@ -937,7 +937,7 @@
|
||||
<!-- Suppress travel confirmation -->
|
||||
<fieldset>
|
||||
<label for="settingsSuppressTravelConfirmation" class="tooltip">Suppress Travel Confirmation:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, the confirmation message before traveling will not show up. You will automatically be deducted the travel cost as soon as you click.
|
||||
</span>
|
||||
</label>
|
||||
@ -948,7 +948,7 @@
|
||||
<!-- Suppress buy aug confirmation -->
|
||||
<fieldset>
|
||||
<label for="settingsSuppressBuyAugmentationConfirmation" class="tooltip">Suppress buy augmentation confirmation:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, the confirmation message before buying augmentation will not show up.
|
||||
</span>
|
||||
</label>
|
||||
@ -958,7 +958,7 @@
|
||||
<!-- Hospitalization Popup -->
|
||||
<fieldset>
|
||||
<label for="settingsSuppressHospitalizationPopup" class="tooltip">Suppress Hospitalization popup:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, a popup message will no longer be shown when you are hospitalized after taking too much damage.
|
||||
</span>
|
||||
</label>
|
||||
@ -968,7 +968,7 @@
|
||||
<!-- Disable Terminal and Navigation Shortcuts -->
|
||||
<fieldset>
|
||||
<label for="settingsDisableHotkeys" class="tooltip">Disable Hotkeys:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, then most hotkeys (keyboard shortcuts) in the game are disabled.
|
||||
This includes Terminal commands, hotkeys to navigate between different parts of the game,
|
||||
and the "Save and Close (Ctrl + b)" hotkey in the Text Editor.
|
||||
@ -977,6 +977,32 @@
|
||||
<input type="checkbox" name="settingsDisableHotkeys" id="settingsDisableHotkeys">
|
||||
</fieldset>
|
||||
|
||||
<!-- Locale for displaying numbers -->
|
||||
<fieldset>
|
||||
<label for="settingsLocale" class="tooltip">Locale:
|
||||
<span class="tooltiptexthigh">
|
||||
Sets the locale for displaying numbers. Defaults to 'en'
|
||||
</span>
|
||||
</label>
|
||||
<select name="settingsLocale" id="settingsLocale">
|
||||
<option value="en">en</option>
|
||||
<option value="bg">bg</option>
|
||||
<option value="cs">cs</option>
|
||||
<option value="da-dk">da-dk</option>
|
||||
<option value="de">de</option>
|
||||
<option value="en-au">en-au</option>
|
||||
<option value="en-gb">en-gb</option>
|
||||
<option value="es">es</option>
|
||||
<option value="fr">fr</option>
|
||||
<option value="hu">hu</option>
|
||||
<option value="it">it</option>
|
||||
<option value="lv">lv</option>
|
||||
<option value="no">no</option>
|
||||
<option value="pl">pl</option>
|
||||
<option value="ru">ru</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<!-- Donate button -->
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
|
||||
<input type="hidden" name="cmd" value="_s-xclick">
|
||||
@ -997,14 +1023,14 @@
|
||||
<a id="import-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Import Game </a>
|
||||
<a id="debug-delete-scripts-link" class="a-link-button tooltip" style="display:block;width:46%;">
|
||||
(DEBUG) Delete Active Scripts
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptextleft">
|
||||
Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
|
||||
using this, save the game and then reload the page.
|
||||
</span>
|
||||
</a>
|
||||
<a id="debug-soft-reset" class="a-link-button tooltip" style="display:block;width:46%;">
|
||||
(DEBUG) Soft Reset
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptextleft">
|
||||
Perform a soft reset. Resets everything as if you had just purchased an Augmentation.
|
||||
</span>
|
||||
</a>
|
||||
|
@ -19,6 +19,11 @@ interface IDefaultSettings {
|
||||
*/
|
||||
DisableHotkeys: boolean;
|
||||
|
||||
/**
|
||||
* Locale used for display numbers
|
||||
*/
|
||||
Locale: string;
|
||||
|
||||
/**
|
||||
* Limit the number of log entries for each script being executed on each server.
|
||||
*/
|
||||
@ -91,6 +96,7 @@ const defaultSettings: IDefaultSettings = {
|
||||
AutosaveInterval: 60,
|
||||
CodeInstructionRunTime: 50,
|
||||
DisableHotkeys: false,
|
||||
Locale: "en",
|
||||
MaxLogCapacity: 50,
|
||||
MaxPortCapacity: 50,
|
||||
SuppressBuyAugmentationConfirmation: false,
|
||||
@ -110,6 +116,7 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
|
||||
DisableHotkeys: defaultSettings.DisableHotkeys,
|
||||
EditorKeybinding: "ace",
|
||||
EditorTheme: "Monokai",
|
||||
Locale: "en",
|
||||
MaxLogCapacity: defaultSettings.MaxLogCapacity,
|
||||
MaxPortCapacity: defaultSettings.MaxPortCapacity,
|
||||
SuppressBuyAugmentationConfirmation: defaultSettings.SuppressBuyAugmentationConfirmation,
|
||||
|
@ -928,7 +928,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
||||
<!-- Suppress faction invites -->
|
||||
<fieldset>
|
||||
<label for="settingsSuppressFactionInvites" class="tooltip">Suppress Faction Invites:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, then any faction invites you receive will not appear as popups
|
||||
on the screen. Your outstanding faction invites can be viewed in the 'Factions' page.
|
||||
</span>
|
||||
@ -939,7 +939,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
||||
<!-- Suppress travel confirmation -->
|
||||
<fieldset>
|
||||
<label for="settingsSuppressTravelConfirmation" class="tooltip">Suppress Travel Confirmation:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, the confirmation message before traveling will not show up. You will automatically be deducted the travel cost as soon as you click.
|
||||
</span>
|
||||
</label>
|
||||
@ -950,7 +950,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
||||
<!-- Suppress buy aug confirmation -->
|
||||
<fieldset>
|
||||
<label for="settingsSuppressBuyAugmentationConfirmation" class="tooltip">Suppress buy augmentation confirmation:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, the confirmation message before buying augmentation will not show up.
|
||||
</span>
|
||||
</label>
|
||||
@ -960,7 +960,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
||||
<!-- Hospitalization Popup -->
|
||||
<fieldset>
|
||||
<label for="settingsSuppressHospitalizationPopup" class="tooltip">Suppress Hospitalization popup:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, a popup message will no longer be shown when you are hospitalized after taking too much damage.
|
||||
</span>
|
||||
</label>
|
||||
@ -970,7 +970,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
||||
<!-- Disable Terminal and Navigation Shortcuts -->
|
||||
<fieldset>
|
||||
<label for="settingsDisableHotkeys" class="tooltip">Disable Hotkeys:
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptexthigh">
|
||||
If this is set, then most hotkeys (keyboard shortcuts) in the game are disabled.
|
||||
This includes Terminal commands, hotkeys to navigate between different parts of the game,
|
||||
and the "Save and Close (Ctrl + b)" hotkey in the Text Editor.
|
||||
@ -979,6 +979,32 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
||||
<input type="checkbox" name="settingsDisableHotkeys" id="settingsDisableHotkeys">
|
||||
</fieldset>
|
||||
|
||||
<!-- Locale for displaying numbers -->
|
||||
<fieldset>
|
||||
<label for="settingsLocale" class="tooltip">Locale:
|
||||
<span class="tooltiptexthigh">
|
||||
Sets the locale for displaying numbers. Defaults to 'en'
|
||||
</span>
|
||||
</label>
|
||||
<select name="settingsLocale" id="settingsLocale">
|
||||
<option value="en">en</option>
|
||||
<option value="bg">bg</option>
|
||||
<option value="cs">cs</option>
|
||||
<option value="da-dk">da-dk</option>
|
||||
<option value="de">de</option>
|
||||
<option value="en-au">en-au</option>
|
||||
<option value="en-gb">en-gb</option>
|
||||
<option value="es">es</option>
|
||||
<option value="fr">fr</option>
|
||||
<option value="hu">hu</option>
|
||||
<option value="it">it</option>
|
||||
<option value="lv">lv</option>
|
||||
<option value="no">no</option>
|
||||
<option value="pl">pl</option>
|
||||
<option value="ru">ru</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<!-- Donate button -->
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
|
||||
<input type="hidden" name="cmd" value="_s-xclick">
|
||||
@ -999,14 +1025,14 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
||||
<a id="import-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Import Game </a>
|
||||
<a id="debug-delete-scripts-link" class="a-link-button tooltip" style="display:block;width:46%;">
|
||||
(DEBUG) Delete Active Scripts
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptextleft">
|
||||
Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
|
||||
using this, save the game and then reload the page.
|
||||
</span>
|
||||
</a>
|
||||
<a id="debug-soft-reset" class="a-link-button tooltip" style="display:block;width:46%;">
|
||||
(DEBUG) Soft Reset
|
||||
<span class="tooltiptext">
|
||||
<span class="tooltiptextleft">
|
||||
Perform a soft reset. Resets everything as if you had just purchased an Augmentation.
|
||||
</span>
|
||||
</a>
|
||||
|
@ -1,6 +1,8 @@
|
||||
import {Engine} from "../engine";
|
||||
import {Settings} from "../Settings";
|
||||
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
|
||||
function setSettingsLabels() {
|
||||
var nsExecTime = document.getElementById("settingsNSExecTimeRangeValLabel");
|
||||
var nsLogLimit = document.getElementById("settingsNSLogRangeValLabel");
|
||||
@ -12,6 +14,7 @@ function setSettingsLabels() {
|
||||
var suppressHospitalizationPopup = document.getElementById("settingsSuppressHospitalizationPopup");
|
||||
var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel");
|
||||
var disableHotkeys = document.getElementById("settingsDisableHotkeys");
|
||||
var locale = document.getElementById("settingsLocale");
|
||||
|
||||
//Initialize values on labels
|
||||
nsExecTime.innerHTML = Settings.CodeInstructionRunTime + "ms";
|
||||
@ -24,8 +27,9 @@ function setSettingsLabels() {
|
||||
suppressHospitalizationPopup.checked = Settings.SuppressHospitalizationPopup;
|
||||
autosaveInterval.innerHTML = Settings.AutosaveInterval;
|
||||
disableHotkeys.checked = Settings.DisableHotkeys;
|
||||
locale.value = Settings.Locale;
|
||||
|
||||
//Set handlers for when input changes
|
||||
//Set handlers for when input changes for sliders
|
||||
var nsExecTimeInput = document.getElementById("settingsNSExecTimeRangeVal");
|
||||
var nsLogRangeInput = document.getElementById("settingsNSLogRangeVal");
|
||||
var nsPortRangeInput = document.getElementById("settingsNSPortRangeVal");
|
||||
@ -60,6 +64,7 @@ function setSettingsLabels() {
|
||||
}
|
||||
};
|
||||
|
||||
//Set handlers for when settings change on checkboxes
|
||||
suppressMsgs.onclick = function() {
|
||||
Settings.SuppressMessages = this.checked;
|
||||
};
|
||||
@ -84,6 +89,21 @@ function setSettingsLabels() {
|
||||
Settings.DisableHotkeys = this.checked;
|
||||
}
|
||||
|
||||
//Locale selector
|
||||
locale.onchange = function() {
|
||||
if (numeral.locale(locale.value) == null) {
|
||||
console.warn(`Invalid locale for numeral: ${locale.value}`);
|
||||
|
||||
let defaultValue = 'en';
|
||||
numeral.locale(defaultValue);
|
||||
Settings.Locale = defaultValue;
|
||||
locale.value = defaultValue;
|
||||
return;
|
||||
}
|
||||
|
||||
Settings.Locale = locale.value;
|
||||
}
|
||||
|
||||
//Theme
|
||||
if (Settings.ThemeHighlightColor == null || Settings.ThemeFontColor == null || Settings.ThemeBackgroundColor == null) {
|
||||
console.log("ERROR: Cannot find Theme Settings");
|
||||
|
Loading…
Reference in New Issue
Block a user