Giter VIP home page Giter VIP logo

Comments (11)

Sloaix avatar Sloaix commented on May 31, 2024 1

Since many countries and regions use Simplified Chinese and Traditional Chinese, I will refactor the code for the multi-language section and divide it according to language rather than country.

The country flag of language selector will be removed.

zh-Hans for Simplified Chinese, and zh-Hant for Traditional Chinese.

from gofi.

Sloaix avatar Sloaix commented on May 31, 2024

front-end: Gofi/gofi-frontend/src/i18n
back-end: Gofi/gofi-backend/i18n

Currently, the multi-language support is not perfect. Besides modifying the translation files, we also need to modify the code. Could you tell me which language you want to support?

from gofi.

Sloaix avatar Sloaix commented on May 31, 2024

A few minutes ago, i migrated the router from reach router to react router V6. In the next time, I can try to add the language you want gofi to support.

from gofi.

Sloaix avatar Sloaix commented on May 31, 2024

I plan to improve the document tomorrow, but I need to upgrade a latest docker image tag for master branch to match the new document.

from gofi.

changchichung avatar changchichung commented on May 31, 2024

Could you tell me which language you want to support?

ja-JP , zh-TW and fr-FR

from gofi.

Sloaix avatar Sloaix commented on May 31, 2024

I will try to refactor the i18n part of the code today to support localized translation files. I will reply you after all the preparation work to support other languages is completed.

Then you can start localizing.

If you want to try to build locally, clone Gofi master branch first , then run yarn && yarn build and make sure docker and node14 yarn are installed.

But it might be a little late because I'm leaving for a haircut in an hour.

from gofi.

changchichung avatar changchichung commented on May 31, 2024

well , I did try build locally .

yarn && yarn build error

Checking for required docker image techknowlogick/xgo:latest... found.
Cross compiling ./...
Enabled Go module support
Building /source/go.mod...
Compiling for darwin-10.12/amd64...
main.go:17:12: pattern dist/*: no matching files found
Compiling for darwin-10.12/arm64...
main.go:17:12: pattern dist/*: no matching files found
Cleaning up build environment...
chown: cannot access '/build/gofi*': No such file or directory
2021/11/11 15:06:23 Failed to cross compile package: exit status 1.
[15:06:23] Finished 'build-backend' after 5.58 min
[15:06:23] Starting 'after-build'...
[15:06:23] Finished 'after-build' after 1.64 ms
[15:06:23] Finished 'build' after 5.6 min
[15:06:23] Finished 'build-production' after 5.6 min
[15:06:23] Finished 'default' after 5.6 min
Done in 337.21s.

I have to download from beta release eand extract the dist folder.

but with the new binary , I only see a blank page , and no error message in console.

I will wait for your next release .

from gofi.

Sloaix avatar Sloaix commented on May 31, 2024

You can run the latest gofi from the master branch via docker

docker run -d \
              --name=gofi \
              -p 80:8080 \
              -v ~/gofi:/app \
              -v ~/gofi/storage:/app/storage \
              --restart unless-stopped \
              sloaix/gofi:nightly-prod-latest

and you can find latest build from Gofi-nightly-build,or latest docker image from Docker Hub

from gofi.

Sloaix avatar Sloaix commented on May 31, 2024

Clone latest code

You must clone latest code.

First translate the frontend

  • Copy /gofi-frontend/i18n/ zh-hans to zh-hant
  • Copy /gofi-frontend/i18n/zh-hans.ts to zh-hant.ts

After completion of translation, open /Gofi/gofi-frontend/src/i18n/index.ts file, add language pack for zh-Hant (Notice adding aliases for zh-Hant)

// /Gofi/gofi-frontend/src/i18n/index.ts

import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import en from './en'
import zhHans from './zh-Hans'
// import zhHant from './zh-Hant'
const resources = {
    en: {
        translation: en,
    },
    'zh-Hans': {
        translation: zhHans,
    },
    // alias for zh-Hans
    'zh-CN': {
        translation: zhHans,
    },
    // alias for zh-Hans
    'zh-SG': {
        translation: zhHans,
    },
    // 'zh-Hant': {
    //     translation: zhHant,
    // },
    // // alias for zh-Hant
    // 'zh-TW': {
    //     translation: zhHant,
    // },
    // // alias for zh-Hant
    // 'zh-HK': {
    //     translation: zhHant,
    // }
}

i18n.use(initReactI18next).init({
    resources: resources,
    lng: 'en',
    fallbackLng: 'en',
    interpolation: {
        escapeValue: false,
    },
})

export default i18n

Second translate the backend

Copy /Gofi/gofi-backend/i18n/zh_Hans.go to zh_Hant.go , after completion of translation, open /Gofi/gofi-backend/i18n/translate.go file to add language pack.

//  /Gofi/gofi-backend/i18n/translate.go
func init() {
	for _, key := range TranslateKeys {
        // add translation pack
        _ = message.SetString(language.TraditionalChinese, key.String(), ZhHant[key])

		_ = message.SetString(language.SimplifiedChinese, key.String(), ZhHans[key])
		_ = message.SetString(language.English, key.String(), En[key])
	}
	printer = message.NewPrinter(language.Chinese)
}

from gofi.

changchichung avatar changchichung commented on May 31, 2024

after doing some translating work , there's no way to select new lang files in Gofi UI

gofi version

UPDATE:

edit gofi-frontend/src/components/layouts/MainLayout/LangSelect.tsx , add the languages just been translated . (not mentioned above ) and re-compile again.

and also don't forget to edit gofi-frontend/src/pages/file/FileViewer.tsx , the messages here does not include in the lang pack.

from gofi.

Sloaix avatar Sloaix commented on May 31, 2024

well , I did try build locally .

yarn && yarn build error

Checking for required docker image techknowlogick/xgo:latest... found.
Cross compiling ./...
Enabled Go module support
Building /source/go.mod...
Compiling for darwin-10.12/amd64...
main.go:17:12: pattern dist/*: no matching files found
Compiling for darwin-10.12/arm64...
main.go:17:12: pattern dist/*: no matching files found
Cleaning up build environment...
chown: cannot access '/build/gofi*': No such file or directory
2021/11/11 15:06:23 Failed to cross compile package: exit status 1.
[15:06:23] Finished 'build-backend' after 5.58 min
[15:06:23] Starting 'after-build'...
[15:06:23] Finished 'after-build' after 1.64 ms
[15:06:23] Finished 'build' after 5.6 min
[15:06:23] Finished 'build-production' after 5.6 min
[15:06:23] Finished 'default' after 5.6 min
Done in 337.21s.

I have to download from beta release eand extract the dist folder.

but with the new binary , I only see a blank page , and no error message in console.

I will wait for your next release .

Fixed bug where no dist directory was found in the development environment causing build failure

main.go:17:12: pattern dist/*: no matching files found

see 16c28d4

If you want to try to develop or build locally , try:

  • under gofi-frontend, run yarn && yarn run dev
  • under gofi-backend, run go run main.go

Gofi frontend listens to port 3000, backend listens to port 8080, in the development environment.

from gofi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.