Uniswap / interface

🦄 Open source interfaces for the Uniswap protocol

Home Page:https://app.uniswap.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unable to resolve translations when start in local

nanne007 opened this issue · 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?

commented

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) => {