question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: mergedOptions.onMissingTranslation is not a function

See original GitHub issue

I’m not sure if this is a bug or a feature, as its kind of jumping outside of the bounds of the documentation.

I currently have a boot-server file where I follow Option 2 from this thread using the exposed action creators, as I inject the localisations once off during server render. (this was how I injected the localisations in the prior version)

export default createServerRenderer((params) => {
 return new Promise<RenderResult>((resolve, reject) => {

  // Prepare Redux store with in-memory history, 
  const store = configureStore(createMemoryHistory());

  const { translations } = params.data;

  const onMissingTranslation = ({ translationId, languageCode }) => {
         console.log(`Missing translationId: ${ translationId } for language: ${ languageCode }`);
         return `Label Not Set`;
     };

     // get translation files
     store.dispatch(initialize({
         languages: [{ name: 'English', code: 'en' }],
         translation: translations,
         options: {
             onMissingTranslation,
             renderInnerHtml: true,
             renderToStaticMarkup,
             defaultLanguage: 'en',
         }
     }));
     store.dispatch(addTranslationForLanguage(translations, 'en'));
     store.dispatch(setActiveLanguage('en'));

    // some code   

     const app = (
         <LocalizeProvider store={store}>
             <Provider store={store}>
                 <StaticRouter context={routerContext} location={params.location.path}
                               children={routes(instanceType, appRoutes)}/>
             </Provider>
         </LocalizeProvider>
     );    

     // etc...
 });
});

It works for the most part. That being said… since swapping over, and using the technique above. I have not been able to get the onMissingTranslations to actually work (javascript just explodes if there is no translation for a key) keep getting this error ‘Uncaught TypeError: mergedOptions.onMissingTranslation is not a function’ even with the above set.

Even when not setting the onMissingTranslation, I get the same issue… thus leading me to believe my setup or boot code might be somewhat wonky.

Versions: “react”: “16.2.0”, “react-redux”: “5.0.6”, “react-localize-redux”: “3.1.1”,

Side note… I’m not able to upgrade react version yet, as they’re aiming to remove some hooks that I depend on for SSR purposes… so I’m giving it some time until they stabilise.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rohan-buchnercommented, Jul 26, 2018

@ryandrewjohnson whoa… I seem to have disappeared in the void… we had some flu going round at the office… let me take a stab at that and let you know whats up. sorry for the delay in my response. thanks for the snippet

1reaction
samuelg0rd0ncommented, Jul 26, 2018

@ryandrewjohnson I’ll be happy to help you. I’m just not sure what exactly you mean by editing the LocalizeProvider code. I have a react-localize-redux package in node_modules. What file exactly should I modify? lib/LocalizeProvider.js?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: translate is not a function - Stack Overflow
I'm using react-admin 2.3.3, i can post my packages.json if you want. I tried to clean my modules and install it again without...
Read more >
Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError - Some selector is not a function - jQuery is not a function - owlCarousel...
Read more >
How to fix "Uncaught TypeError: x is not a function" in JavaScript
JS Casts 01 - How to fix " Uncaught TypeError : x is not a function " in JavaScript.Visit https://javascriptcasts.com/episodes/01 for a summary ......
Read more >
TypeError: Object(...) is not a function : r/reactjs - Reddit
Hello, While working in React I made an ES6 arrow function. When I saved my work and the app automatically reloaded in Chrome,...
Read more >
InProduct Translation v1.2.0 causes t.widget.extend is not a ...
Uncaught TypeError : t.widget.extend is not a function at t.<computed>.<computed>._createWidget (batch.js?locale=en-US:970) at new t.<computed>.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found