title: i18n translate text in a function
body: <p>I'm having some problem to translate some error message outside a components. </p>
  
  <p>this is my i18n setting </p>
  
  <pre><code>const languageDetector = {
    type: 'languageDetector',
    async: true,
    detect: (cb: (baseLanguage: string) =&gt; void) =&gt; {
      let prevLanguage: string;
      store.subscribe(() =&gt; {
        const selectBaseLanguage = makeSelectBaseLanguage();
        const baseLanguage = selectBaseLanguage(store.getState());
        if (baseLanguage !== prevLanguage) {
          prevLanguage = baseLanguage;
          cb(baseLanguage);
        }
      });
    },
    init: () =&gt; {},
    cacheUserLanguage: () =&gt; {},
  };
  
  i18n
    .use(languageDetector)
    .use(initReactI18next) // passes i18n down to react-i18next
    .init({
      debug: true,
      resources: languagesResources,
      // language to use if translations in user language are not available.
      fallbackLng: defaultLanguage,
      interpolation: {
        escapeValue: false, // not needed for react as it escapes by default
      },
  
      react: {
        wait: false,
        useSuspense: false,
      },
    });
  </code></pre>
  
  <p>i've to reach the errors code in this file ----> <code>httpErrors: en_HttpError</code></p>
  
  <p>path file : <code>@config/locales/languageConfig</code></p>
  
  <pre><code>export const languagesResources = {
    en: { ...en, httpErrors: en_HttpError },
    tr: { ...tr, httpErrors: tr_HttpError },
  };
  </code></pre>
  
  <p>and this is the <code>function*</code> where i need to reach the traduction: </p>
  
  <p>path file : <code>@config/utils/helpers</code></p>
  
  <pre><code>export function* _handleFetchError(error: any) {
    const { httpStatus, httpDescriptions, errorCode, errorDescription } = error;
    console.log('!!! Start Error Handler !!!:', httpStatus, httpDescriptions, errorCode, errorDescription);
  
    const test = i18n.t('en_HttpError');
  
    yield put(sagaShowFullScreenOverlay(GenericOverlay, errorModal));
  }
  </code></pre>
  
  <p>right now with the <code>const test</code> i obtain only an undefined error,</p>
  
  <p>How can i obtain the right traduction based on the errorCode value that I receive without have an undefined error ? </p>