ItsSim / fsolauncher

Official FreeSO Launcher made with Electron
https://beta.freeso.org
Mozilla Public License 2.0
14 stars 9 forks source link

[Windows/Mac] Incorrect download error messages #33

Closed ItsSim closed 2 years ago

ItsSim commented 2 years ago

Describe the bug There are a few places where the error message shown to the user mentions the wrong component, it always says "FreeSO". Happens upon a failed installation of the Remesh Package, Simitone, SDL, Mono or macOS extras.

To Reproduce Steps to reproduce the behavior:

  1. Go to installer
  2. Install one of the components listed above
  3. Force a network error to happen (temporarily turn off internet for instance).
  4. See the wrong error message

Expected behavior The correct component name should appear in the error text. The best way to fix this would be to use the correct language string (from global.locale) in each installer that is showing the wrong message. Need to duplicate the FSO_FAILED_INSTALLATION for each language and component, rename the key and replace "FreeSO" with the correct component name (i.e. SIMITONE_FAILED_INSTALLATION, MONO_FAILED_INSTALLATION...).

Screenshots Example Remesh Package fail:

image

Desktop (please complete the following information): Any OS

Additional context N/A

ItsSim commented 2 years ago

Perhaps this could be an opportunity to enhance how language strings are treated and add the capability to put placeholders for words i.e. "Failed to install %s. Try again later".

Thinking of creating a new utils.js module for a strFormat function, which could simply be:

const strFormat = ( str, ...args ) => args.reduce( ( s, v ) => s.replace( '%s', v ), str );
const normalizePathSlashes = d => d ? d.replace( /\\/g, '/' ) : d;
module.exports = {
  strFormat, normalizePathSlashes
}

Also added the normalizePathSlashes function which is already present in main.js, but added as a global function (which isn’t ideal). All invocations of that function would need to be changed (I think it’s only 3).

With this module, formatting a language string would be as a easy as strFormat( global.LANGUAGE_STRING, "Text" );

This function would be gradually adopted across all language strings over time and would prevent unnecessary duplicates like the string indicated in this issue.

ItsSim commented 2 years ago

Fixed in 4dac61ef8b3c0454397543a182b28176c0105224 Also implemented what I commented in the last comment.