Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

i18n.js Unable to resolve "make-plural" from Pluralization.js

I have a react native app and I am using expo.

I want to translate my mobile app so I am going to use expo-localization and i18n-js which I have installed following in the expo documentation.

Then I import it in my App.js as so:

import * as Localization from "expo-localization";
import i18n from "i18n-js";

I have also tried importing it this way :

import * as Localization from "expo-localization";
import { I18n } from "i18n-js";

but when importing i18n I get the following error:

Unable to resolve "make-plural" from "node_modules/i18n-js/dist/import/Pluralization.js"

In my package.json I have the following versions:

"i18n-js": "^4.2.3",
"expo-localization": "~13.1.0",

How can I fix this issue?

like image 348
colla Avatar asked Jan 20 '26 21:01

colla


1 Answers

Remember to also extend expo/metro-config

 const { getDefaultConfig } = require('expo/metro-config');
 const config = getDefaultConfig(__dirname);
 
 // Adds support for `mjs` files 
 config.resolver.sourceExts.push('mjs' ); 
 
 module.exports = config;
like image 70
Marthin Hauge Avatar answered Jan 22 '26 12:01

Marthin Hauge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!