forehalo
9043e6607e
refactor(i18n): lazy load languages ( #8456 )
...
closes AF-1397
2024-10-10 09:03:06 +00:00
EYHN
096f50b83b
chore(i18n): cleanup i18n file ( #8318 )
2024-09-20 06:25:17 +00:00
EYHN
7c0a686cd9
refactor(i18n): new hook api ( #7273 )
...
# NEW HOOK API
`useI18n`: same as `useAFFiNEI18N`, with additional APIs
```ts
import { useI18n } from '@affine/i18n'
const i18n = useI18n()
i18n['hello world']() -> 你好世界
```
# NEW GLOBAL i18n Instance
`I18n`: use i18n capabilities outside of React
```ts
import { I18n } from '@affine/i18n'
I18n['hello world']() -> 你好世界
```
# NEW TYPES
`I18nKeys` -> all i18n keys
`I18nString` -> An i18n message (key&options)
transfer and store i18n text outside of React
```ts
const msg: I18nString = {
key: 'helloworld',
options: {
arg1: '123'
}
}
I18n.t(msg) -> 你好世界123
```
before:
```ts
registerCommand('open-page', {
name: t('command.open-page')
// ^- translation happens here,
})
```
after:
```ts
registerCommand('open-page', {
name: { key: 'command.open-page' }
// ^- store I18nString here, translate when the command render to UI
})
```
2024-06-20 02:19:41 +00:00
EYHN
bcc66422fd
refactor(i18n): i18n utils tools ( #7251 )
2024-06-19 07:38:20 +00:00
akumatus
261d413607
feat: history timeline shows relative time, such as today and yesterday ( #6864 )
...
### TL;DR
First, fixed an i18n issue in history panel. When the browser language is set to Chinese, and the AFFiNE application language is set to English, the language supposed to be English global. But now the language is a mixture of Chinese and English, which is obviously wrong.

Second, design a time formatter to convert timestamp into relative calendar date, such today and yesterday and so on. Long-ago edits will show the exact date like before.

### What changed?
- `new Intl.DateTimeFormat` with language option form `document.documentElement.lang`
- Added `timestampToCalendarDate` function to convert timestamp into relative calendar date
- Updated unit tests
- Updated i18n copywriting
### How to test?
1. Open view history version
2. Check edit timeline
2024-05-13 11:59:48 +00:00
EYHN
f2adbdaba4
style: enable import-x/no-duplicates ( #6279 )
2024-03-25 03:55:33 +00:00
LongYinan
3148f93ee7
style: add perf rules ( #5413 )
2023-12-28 05:09:30 +00:00
LongYinan
cb4f6d30af
chore: bump up react-i18next version to v14 ( #5375 )
...
[](https://renovatebot.com )
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [react-i18next](https://togithub.com/i18next/react-i18next ) | [`^13.3.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/react-i18next/13.5.0/14.0.0 ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) |
---
### Release Notes
<details>
<summary>i18next/react-i18next (react-i18next)</summary>
### [`v14.0.0`](https://togithub.com/i18next/react-i18next/blob/HEAD/CHANGELOG.md#1400 )
[Compare Source](https://togithub.com/i18next/react-i18next/compare/v13.5.0...v14.0.0 )
- types: reportNamespaces is now optional, should fix [1693](https://togithub.com/i18next/react-i18next/issues/1693 )
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/ ). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEwMy4xIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
2023-12-26 08:32:07 +00:00
LongYinan
d267029761
fix: add prefer-array-some rule ( #5109 )
2023-11-29 04:43:43 +00:00
LongYinan
3499dbbb7f
feat: upgrade dependencies and lockfile ( #5016 )
...
- Close https://github.com/toeverything/AFFiNE/security/dependabot/47
2023-11-23 05:18:05 +00:00
Joooye_34
bed9310519
refactor(infra): directory structure ( #4615 )
2023-10-18 15:30:08 +00:00