Skip to content

Commit

Permalink
chore: localization
Browse files Browse the repository at this point in the history
  • Loading branch information
BroKun committed Nov 5, 2024
1 parent 95a3cc9 commit 762507c
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 35 deletions.
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,46 @@

[![codecov](https://codecov.io/gh/difizen/mana/graph/badge.svg?token=VGJDF8511R)](https://codecov.io/gh/difizen/mana)

模块化可扩展前端框架
A modular and extensible front-end framework designed for workbench products.

- 如果你打算开发 IDE 型的生产力工具
- 如果你的项目需要丰富的场景定制能力
- 如果你正在寻找彻底模块化的前端工程方案
**English** · [简体中文](./README.zh-CN.md)

请尝试 mana 🌟🌟🌟
## Features

### 官网
- Complete module isolation, state management, and dependency inversion solutions, making it a truly suitable framework for large-scale engineering
- Integration with the react ecosystem, with innovative page view management and state tracking capabilities, perfectly combining frontend projects with a modular structure
- Built-in modules such as themes, commands, shortcuts, toolbars, configurations, internationalization, etc., to help you quickly start your project

💡 请访问 https://mana.difizen.net/
## Applicable Scenarios

### 提交issue
- If you intend to develop IDE-style productivity tool products
- If you are looking for a thoroughly modular, architecturally advanced frontend engineering solution to solve team collaboration and long-term maintenance issues
- If your project requires rich scene customization capabilities, allowing downstream producers to do kernel-level customization and develop a module ecosystem

😊 我们建议您使用[github issue](https://github.com/difizen/mana/issues) 提交您的疑问, 我们通常会在2日内回复。
Please try mana 🌟🌟🌟

### 贡献代码
### Official Website

🤝 请查阅 [CONTRIBUTING.md](./CONTRIBUTING.md)
💡 Please visit https://mana.difizen.net/

### 贡献者
### Submit Issues

💪 感谢所有的贡献者
😊 We recommend using [github issue](https://github.com/difizen/mana/issues) to submit your questions, and we usually respond within two days.

### Contribute Code

🤝 Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md)

### Contributors

💪 Thanks to all the contributors

<a href="https://github.com/difizen/mana/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=difizen/mana" alt="List of Contributors"/>
</a>

### 联系我们
### Contact Us

🤗 加入我们的钉钉答疑群与我们联系。
🤗 Join our DingTalk Q&A group to contact us.

<img src="./apps/docs/public/ding-qrcode.png" width="30%">
47 changes: 47 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# mana

[![codecov](https://codecov.io/gh/difizen/mana/graph/badge.svg?token=VGJDF8511R)](https://codecov.io/gh/difizen/mana)

一个模块化可扩展前端框架,为工作台产品设计。

[English](./README.md) · **简体中文**

## 特性

- 完整的模块隔离、状态管理、依赖倒置方案,是真正适合大型工程的框架
- 集成 react 生态,创造性的页面视图管理、状态追踪能力,让前端项目与模块化结构完美结合
- 内置主题、命令、快捷键、工具栏、配置、国际化...等模块,帮助您快速启动项目

## 适用场景

- 如果您打算开发 IDE 型的生产力工具产品
- 如果您正在寻找彻底模块化、架构先进的前端工程方案,解决团队的协作和长期维护问题
- 如果您的项目需要丰富的场景定制能力,允许下游生产者做内核级的定制,发展模块生态

请尝试 mana 🌟🌟🌟

### 官网

💡 请访问 https://mana.difizen.net/

### 提交issue

😊 我们建议您使用[github issue](https://github.com/difizen/mana/issues) 提交您的疑问, 我们通常会在2日内回复。

### 贡献代码

🤝 请查阅 [CONTRIBUTING.md](./CONTRIBUTING.md)

### 贡献者

💪 感谢所有的贡献者

<a href="https://github.com/difizen/mana/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=difizen/mana" alt="List of Contributors"/>
</a>

### 联系我们

🤗 加入我们的钉钉答疑群与我们联系。

<img src="./apps/docs/public/ding-qrcode.png" width="30%">
10 changes: 2 additions & 8 deletions apps/docs/.dumi/theme/componets/banner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { l10n } from '@difizen/mana-l10n';
import { Button, message } from 'antd';
import { Link, useSiteData } from 'dumi';
import React, { useEffect, useState } from 'react';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import './index.less';
import '../../tailwind.out.css';
import { l10n } from '@difizen/mana-l10n';

const Banner: React.FC = () => {
const [animate, setAnimate] = useState({
Expand All @@ -20,10 +20,6 @@ const Banner: React.FC = () => {
});
}, []);

if (!themeConfig.banner) {
return null;
}

return (
<div className="difizen-dumi-banner">
<div className="difizen-dumi-banner-main">
Expand All @@ -43,9 +39,7 @@ const Banner: React.FC = () => {
mana
</h1>
<p className="text-xl sm:text-2xl text-muted-foreground mb-8">
{l10n.t(
'A modular and scalable front-end application framework designed for workbench products.',
)}
{l10n.t('A modular and extensible front-end framework')}
</p>
<Link to={'/introduction'}>
<Button type="primary" size="large" className="start-btn">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"Community": "Community",
"feedback issues": "feedback issues",
"release notes": "release notes",
"A modular and scalable front-end application framework designed for workbench products.": "A modular and scalable front-end application framework designed for workbench products."
"A modular and extensible front-end framework": "A modular and extensible front-end framework",
"Designed for workbench products": "Designed for workbench products"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"Community": "社区",
"feedback issues": "反馈问题",
"release notes": "发布日志",
"A modular and scalable front-end application framework designed for workbench products.": "一个模块化的可扩展前端应用框架,为工作台产品设计。"
"A modular and extensible front-end framework": "一个模块化的可扩展前端应用框架",
"Designed for workbench products": "为工作台产品设计"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { LanguageBundles } from '@difizen/mana-l10n';

import langENUS from './bundle.l10n.en-US.json';
import langZHCN from './bundle.l10n.zh-CN.json';
import langENUS from './bundle.l10n.en-US';
import langZHCN from './bundle.l10n.zh-CN';

export const langBundles: LanguageBundles = {
'zh-CN': langZHCN,
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/.dumi/theme/layouts/DocLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const DocLayout = () => {

return (
<ManaComponents.Application modules={[DumiPreset]} renderChildren>
{pathname === '/' ? (
{pathname === '/' || pathname === '/zh-CN' || pathname === '/zh-CN/' ? (
<HomeLayout />
) : (
<div className="difizen-dumi-layout">
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/.dumi/theme/modules/module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ManaAppPreset, ManaModule } from '@difizen/mana-app';
import { l10n } from '@difizen/mana-l10n';

import { langBundles } from '../lang/index.js';

import { Github } from './github.js';
import { langBundles } from './lang/index.js';

export const DumiPreset = ManaModule.create()
.preload(() => {
Expand Down
9 changes: 4 additions & 5 deletions apps/docs/.dumi/theme/slots/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Header: React.FC = () => {
? urlPath.replace(`/${urlLang}`, '')
: `/${currentLang}${urlPath}`;
history.push({
pathname: newUrl,
pathname: newUrl ? newUrl : '/',
});
}
}, []);
Expand Down Expand Up @@ -103,15 +103,14 @@ const Header: React.FC = () => {
onClick={() => {
const urlPath = window.location.pathname;
const currentLang = l10n.getLang();
const baseUrlPath = urlPath.startsWith(`/${currentLang}`)
let baseUrlPath = urlPath.startsWith(`/${currentLang}`)
? urlPath.replace(`/${currentLang}`, '')
: urlPath;
baseUrlPath = baseUrlPath ? baseUrlPath : '/';
const targetLang =
currentLang === L10nLang.zhCN ? L10nLang.enUS : L10nLang.zhCN;

l10n.changeLang(
currentLang === L10nLang.zhCN ? L10nLang.enUS : L10nLang.zhCN,
);
l10n.changeLang(targetLang);

history.push({
pathname:
Expand Down
2 changes: 1 addition & 1 deletion packages/mana-core/src/theme/theme-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ThemeApplication implements ApplicationContribution {

onStart(application: Application): void {
this.application = application;
this.application.onHostChanged(this.update);
this.application.onHostChanged(() => this.update());
for (const contribution of this.variableContributions.getContributions()) {
contribution.registerVariables(this.variables);
}
Expand Down

0 comments on commit 762507c

Please sign in to comment.