Repository: OpenBB-finance/OpenBBTerminal
File: openbb_terminal/config_terminal.py (Python)

Code before:
# IMPORTATION STANDARD
import os

# IMPORTATION INTERNAL
from openbb_terminal.base_helpers import load_env_files, load_env_vars, strtobool
from openbb_terminal.core.config.paths import MISCELLANEOUS_DIRECTORY
from openbb_terminal.core.config.paths_helper import init_userdata
from openbb_terminal.core.plots.backend import plots_backend
from openbb_terminal.core.session.current_user import get_current_user

from .helper_classes import TerminalStyle as _TerminalStyle

# Terminal UX section
current_user = get_current_user()
theme = _TerminalStyle(
    current_user.preferences.MPL_STYLE,
    current_user.preferences.PMF_STYLE,
    current_user.preferences.RICH_STYLE,
)


# Start the plots backend
def start_plot_backend():
    """Starts the plot backend"""
    plots_backend().start(load_env_vars("DEBUG_MODE", strtobool, False))


def start_required_configurations():
    """Starts the required configurations for the terminal to work"""
    load_env_files()
    init_userdata()


Review comment (refactor):
This is not allowing me to test out the terminal:

```
(obb) james@Jamess-MBP OpenBBTerminal % python terminal.py  
Traceback (most recent call last):
  File "/Users/james/OpenBBTerminal/OpenBBTerminal/terminal.py", line 5, in <module>
    import openbb_terminal.config_terminal as cfg  # noqa: F401
  File "/Users/james/OpenBBTerminal/OpenBBTerminal/openbb_terminal/__init__.py", line 13, in <module>
    from .core.plots.plotly_helper import OpenBBFigure, plots_backend, theme, TerminalStyle
  File "/Users/james/OpenBBTerminal/OpenBBTerminal/openbb_terminal/core/plots/__init__.py", line 3, in <module>
    from .plotly_ta.base import Indicator, PltTA, indicator
  File "/Users/james/OpenBBTerminal/OpenBBTerminal/openbb_terminal/core/plots/plotly_ta/base.py", line 5, in <module>
    from .data_classes import ChartIndicators, TAIndicator
  File "/Users/james/OpenBBTerminal/OpenBBTerminal/openbb_terminal/core/plots/plotly_ta/data_classes.py", line 12, in <module>
    from openbb_terminal.common.technical_analysis import ta_helpers
  File "/Users/james/OpenBBTerminal/OpenBBTerminal/openbb_terminal/common/technical_analysis/ta_helpers.py", line 7, in <module>
    from openbb_terminal.rich_config import console
  File "/Users/james/OpenBBTerminal/OpenBBTerminal/openbb_terminal/rich_config.py", line 15, in <module>
    from openbb_terminal import (
  File "/Users/james/OpenBBTerminal/OpenBBTerminal/openbb_terminal/config_terminal.py", line 91, in <module>
    i18n.load_path.append(i18n_dict_location)
NameError: name 'i18n' is not defined
```

Code after:
# IMPORTATION STANDARD
from pathlib import Path

# IMPORTATION THIRDPARTY
from typing import Optional

import i18n

# IMPORTATION INTERNAL
from openbb_terminal.base_helpers import load_env_files
from openbb_terminal.core.config.paths import I18N_DICT_LOCATION
from openbb_terminal.core.config.paths_helper import init_userdata
from openbb_terminal.core.plots.backend import plots_backend
from openbb_terminal.core.session.current_system import (
    get_current_system,
    set_system_variable,
)
from openbb_terminal.core.session.current_user import get_current_user

from .helper_classes import TerminalStyle as _TerminalStyle


def start_plot_backend():
    """Starts the plot backend"""
    plots_backend().start(get_current_system().DEBUG_MODE)


def setup_i18n(i18n_path: Path = I18N_DICT_LOCATION):
    """Select the terminal translation language."""

    i18n.load_path.append(i18n_path)
    i18n.set("locale", get_current_user().preferences.USE_LANGUAGE)