function tryLoadLocaleMessage(messages, id) 
{
  if (messages[id])
    return;
  
  try
  {
    // Try to resolve it. If it does not exist an exception is thrown
    require.resolve(`./locales/${id}.json`);

    // Get the file
    messages[id] = require(`./locales/${id}.json`);

    // Update the active locale
    if (!activeLocale)
      activeLocale = id;

    console.log(`${id} found`);
  }
  catch
  {
    console.log(`${id} not found`);
  }
}
// Try to load a resource for the specific language
Try to load a resource for the specific language
Try to load a resource for the specific language
function tryLoadLocaleMessage(messages, id) 
{
  if (messages[id])
    return;
  try
  {
    require.resolve(`./locales/${id}.json`);
    messages[id] = require(`./locales/${id}.json`);
    if (!activeLocale)
      activeLocale = id;
    console.log(`${id} found`);
  }
  catch
  {
    console.log(`${id} not found`);
  }
}
function tryLoadLocaleMessage ( messages , id ) { if ( messages [ id ] ) return ; try { require . resolve ( ` ${ id } ` ) ; messages [ id ] = require ( ` ${ id } ` ) ; if ( ! activeLocale ) activeLocale = id ; console . log ( ` ${ id } ` ) ; } catch { console . log ( ` ${ id } ` ) ; } }
Try to load a resource for the specific language
Try to load a resource for the specific language
// Try to resolve it. If it does not exist an exception is thrown // Get the file // Update the active locale