Comments (11)
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.
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.
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.
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.
Could you tell me which language you want to support?
ja-JP , zh-TW and fr-FR
from gofi.
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.
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.
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.
Clone latest code
You must clone latest code.
First translate the frontend
- Copy
/gofi-frontend/i18n/ zh-hans
tozh-hant
- Copy
/gofi-frontend/i18n/zh-hans.ts
tozh-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.
after doing some translating work , there's no way to select new lang files in Gofi UI
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.
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)
- 请提供交叉编译指南 HOT 8
- 访问不了。 错误-网络连接断开 HOT 5
- 运行提示 -bash: ./gofi-linux-arm-5: 没有那个文件或目录 HOT 4
- 启动时必须指定-ip参数 HOT 2
- 有人在树莓派上部署么?上传慢不慢? HOT 1
- 为什么要把orm替换成ent呢? HOT 1
- 无法链接到符号链接 HOT 1
- 自从爆发疫情之后作者就不更新代码了呢 HOT 1
- 能否加个搜索文件名的功能? HOT 4
- excel word等办公文件在线预览编辑 HOT 2
- 文档链接挂了 HOT 1
- 好像不支持断点续传和分片下载? HOT 2
- Gofi预计在2021年8月31日前发布基于React重构的beta版本 HOT 2
- 赞一个
- 1.1.0-feature
- Error: network error HOT 1
- what's the default username/password ? HOT 2
- docker安装后无法打开页面 HOT 1
- token might contain string "bearer"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gofi.