interface icon indicating copy to clipboard operation
interface copied to clipboard

unable to resolve translations when start in local

Open nanne007 opened this issue 1 year ago • 1 comments

I followed the guide here https://github.com/Uniswap/interface/tree/main/apps/web to start web interface. I got errors when running yarn start in apps/web folder.

Failed to compile.

Module not found: Error: Can't resolve './i18n/locales/translations' in '/Users/caojiafeng/projects/Uniswap/interface/apps/web/src'
ERROR in ./src/i18n.tsx 20:11-65
Module not found: Error: Can't resolve './i18n/locales/translations' in '/Users/caojiafeng/projects/Uniswap/interface/apps/web/src'

It has something to do with translation. How to resolve the issue?

nanne007 avatar Jun 02 '24 23:06 nanne007

I think there might be a conflict between server-side rendering and client-side rendering. I temporarily solved this issue by directly returning enUsLocale

--- a/apps/web/src/i18n.tsx
+++ b/apps/web/src/i18n.tsx
@@ -18,10 +18,11 @@ i18n
       if (!language.includes('-')) {
         return
       }
-      if (language === 'en-US') {
-        return enUsLocale
-      }
-      return import(`./i18n/locales/translations/${language}.json`)
+      return enUsLocale
+      // if (language === 'en-US') {
+      //   return enUsLocale
+      // }
+      // return import(`./i18n/locales/translations/${language}.json`)
     })
   )
   .on('failedLoading', (language, namespace, msg) => {

JayJay1024 avatar Jun 14 '24 05:06 JayJay1024

Hi, we've recently updated this package to make local development easier as well as updated our contribution guide.

Note that you will need to add the generated folder for now after git cloning the repo: https://github.com/Uniswap/interface/discussions/7718

plondon avatar Apr 30 '25 19:04 plondon