base.Application.reloadResources

Resets FGLRESOURCEPATH and reloads localized string resources.

Syntax

base.Application.reloadResources(
    newResourcePath STRING)
  1. newResourcePath is a list of directories to search for string resource files.

Usage

The reloadResources() method overwrites the search path defined by the FGLRESOURCEPATH environment variable, to find program resource files in directories that are only known at runtime.

Warning:

The reloadResources() method, to reset the FGLRESOURCEPATH environment variable in order to find program resource files in a different directory, must only be used at the beginning of the program execution.

This method is typically used to define a search path for localized string files when a program starts, to let the end user change the current application language. It avoids starting a new application (via RUN), after the end user selects a language in a parent program.

The runtime behaves as if FGLRESOURCEPATH had been set to this value from the start.

Note:

Pay attention to the path separator, which is specific to the operating system. See FGLRESOURCEPATH reference for more details.

The method does the following:

  1. Resets the environment variable FGLRESOURCEPATH with the specified value.
  2. Reloads already loaded string localization files (.42s)
  3. Reloads the default action defaults file (default.4ad)

Notes:

  • Reloading resources has no effect on displayed forms: only forms displayed after reloading resources will use the new reloaded strings.
  • Presentation Styles (.4st) are not reloaded.
    Note:
    The writing direction of a language/script is defined with the UserInterface.reverse presentation style attribute:
    <Style name="UserInterface">
      <StyleAttribute name="reverse" value="yes" />
    </Style>
    Since presentation styles are not reloaded, it is not possible to switch between scripts having different writing directions. To change the writing direction, the program must be restarted.
  • Reloading resources has no effect on .42m modules that are already loaded (any %"string" will not be localized again). For this reason, the reloadResources() method must be called at a very early stage of the program.
    Note:

    The debugger (fglrun -d) loads all program modules immediately when starting. Therefore, reloading resources has no effect on localized strings in .42m modules when debugging.

  • Reloading resources has no effect on files loaded by methods such as ui.Form.loadToolBar, ui.From.loadTopMenu, ui.form.loadActionDefaults, ui.Interface.loadActionDefaults, ui.Interface.loadStartMenu, ui.Interface.loadStyles, ui.Interface.loadToolBar, ui.Interface.loadTopMenu.