/**
 * e.g. lang.json:
 * {
 *   "Welcome": {
 *     "fa": "خوش آمدید",
 *     "fr": "Bienvenue"
 *   },
 *   "Hello": {
 *     "fa": "سلام",
 *     "fr": "Bonjour"
 *   }
 * }
 */

// Current language.json file path
let langFilePath = './lang.json';

// Current selected language, will be used to pick a correct translations
let currentLang = 'default';

// Keep all the translations on texts variable to have fast easy access
// Use require instead of fs.readFile to load lang.json file
let texts = require(langFilePath);

// A flag to check if requested translation not exists return text with symbol
// and output a console.error or not, just return original text
let showError = true;

function __(text, lang = currentLang) {
  // If on default language then return the same text no need to continue
  if (lang === 'default') {
    return text;
  }

  let result = null;

  // If texts load correctly then can access to it's fields
  if (texts) {
    // Get current text translations
    let t = texts[text];

    // If current text available then it's have all translations
    if (typeof t !== 'undefined' && t) {
      // Get selected language translation text
      result = t[lang];
    }
  } else {
    // If texts not available then it's not loaded, return original text
    console.error(`Cant access to ${langFilePath}!`);
    return text;
  }

  // If we have result then return it or return original text with error
  if (result) {
    return result;
  } else {
    if (showError) {
      console.error(`The requested translation not found!\nOriginal text: ${text}\nRequested lang: ${lang}`);
      return '__' + text + '__';
    } else {
      return text;
    }
  }
}

@@ -179,61 +179,34 @@
 */%0A%0A
-// Current language.js
+let c
 on
- 
 fi
-le path%0Alet langF
+g = %7B%0A  f
 ilePath
- =
+:
  './
@@ -219,112 +219,48 @@
 son'
-;%0A%0A// Current selected language, will be used to pick a correct translations%0Alet currentLang = 'default'
+,%0A  lang: 'default',%0A  showError: true%0A%7D
 ;%0A%0A/
@@ -411,21 +411,24 @@
 require(
-langF
+config.f
 ilePath)
@@ -434,213 +434,75 @@
 );%0A%0A
-// A flag to check if requested translation not exists return text with symbol%0A// and output a console.error or not, just return original text%0Alet showError = true;%0A%0Afunction __(text, lang = currentLang) %7B
+function __(text, lang = config.lang) %7B%0A  console.log(config.lang);
 %0A  /
@@ -1090,13 +1090,16 @@
 o $%7B
-langF
+config.f
 ileP
@@ -1456,8 +1456,62 @@
 %7D%0A  %7D%0A%7D%0A
+%0Amodule.exports = __;%0Amodule.exports.config = config;%0A

Use object for config to have shared data & export function