Skip to content

feat: add plugin-i18next#29

Merged
favna merged 21 commits intosapphiredev:mainfrom
Quantumlyy:feat/added/in17n
Jan 1, 2021
Merged

feat: add plugin-i18next#29
favna merged 21 commits intosapphiredev:mainfrom
Quantumlyy:feat/added/in17n

Conversation

@Quantumlyy
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread packages/in17n/package.json Outdated
@Quantumlyy Quantumlyy marked this pull request as ready for review December 24, 2020 20:53
@Quantumlyy Quantumlyy changed the title [WIP] feat(*): added plugin-in17n feat(*): added plugin-in17n Dec 28, 2020
@Quantumlyy Quantumlyy changed the title feat(*): added plugin-in17n [WIP] feat(*): added plugin-in17n Dec 28, 2020
Comment thread packages/in17n/LICENSE.md Outdated
Comment thread packages/in17n/package.json Outdated
Comment thread packages/in17n/package.json Outdated
Comment thread packages/in17n/src/register.ts Outdated
Comment thread packages/in17n/src/lib/types/options.ts
Comment thread packages/in17n/src/lib/In17nHandler.ts Outdated
Comment thread packages/in17n/src/lib/In17nHandler.ts
Comment thread packages/in17n/src/lib/In17nHandler.ts
Comment thread packages/in17n/src/lib/In17nHandler.ts Outdated
Comment thread packages/in17n/src/lib/In17nHandler.ts Outdated
Comment thread packages/in17n/package.json Outdated
Comment thread packages/in17n/package.json Outdated
Comment thread packages/in17n/package.json Outdated
Comment thread packages/in17n/package.json Outdated
Comment thread packages/in17n/package.json Outdated
Comment thread packages/in17n/package.json Outdated
@favna favna changed the title [WIP] feat(*): added plugin-in17n [WIP] feat: add plugin-i18next Dec 28, 2020
@favna favna changed the title [WIP] feat: add plugin-i18next feat: add plugin-i18next Dec 28, 2020
@favna favna marked this pull request as draft December 28, 2020 23:28
Comment thread packages/in17n/package.json Outdated
Quantumlyy and others added 17 commits December 29, 2020 21:54
Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>
Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>
Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>
Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This implements many changes. In17n was renamed to I18next entirely. On this basis: In17nHandler ->
I18nextHandler; In17nOptions -> I18nOptions. In17nMessage is no longer exported, and instead the
discord.js exclusive augmentation is removed by default in order to be framework agnostic. It can
still be accessed via `@sapphire/plugin-i18next/register-discordjs`, though, which adds:
Client.i18n; Client#fetchLanguage; Message#sendTranslated; Message#fetchT; Message#fetchLanguageKey;
Message#fetchLanguage. The standard `@sapphire/plugin-i18next/register` implements only the Sapphire
augmentations (SapphireClient.i18n, SapphireClient#fetchLanguage), and leaves the rest down to the
user, for framework agnosticism. Documentation is added and (incomplete) unit testing also with this
commit.

BREAKING CHANGE: All aforementioned changes are breaking.

RE #29
@Nytelife26 Nytelife26 marked this pull request as ready for review January 1, 2021 12:10
@Nytelife26 Nytelife26 requested review from favna and kyranet January 1, 2021 12:10
Comment thread packages/i18next/README.md Outdated
Comment thread packages/i18next/package.json Outdated
Comment thread packages/i18next/package.json
Comment thread packages/i18next/src/register-discordjs.ts
Comment thread packages/i18next/tests/I18nextHandler.test.ts
Copy link
Copy Markdown
Member

@favna favna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't know if the file actually has no whitelines in the shell script part or if that's just GitHub, if it doesn't then please match the other files.

Also rename the file itself to cd-i18next.yml

Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread .github/workflows/cd-in17n.yml Outdated
Comment thread packages/i18next/src/register-discordjs.ts
Comment thread packages/i18next/src/lib/I18nextHandler.ts
Comment thread packages/i18next/src/lib/I18nextHandler.ts Outdated
@Nytelife26 Nytelife26 requested a review from favna January 1, 2021 17:18
@favna favna enabled auto-merge (squash) January 1, 2021 17:51
Comment thread .github/CODEOWNERS Outdated
Comment thread .github/workflows/cd-i18next.yml
@Nytelife26 Nytelife26 requested a review from favna January 1, 2021 18:15
@favna favna merged commit 41e6581 into sapphiredev:main Jan 1, 2021
Nytelife26 added a commit that referenced this pull request Jan 1, 2021
Prior to this, Message#sendTranslated would always send a new message. Now, it has been relocated to
Message#translated, and an edit (boolean) parameter has been added which denotes whether to edit the
message or send a new one.

BREAKING CHANGE: Message#sendTranslated -> Message#translated

RE #29
Nytelife26 added a commit that referenced this pull request Jan 3, 2021
* fix(i18next): correct misnomer

* feat(i18next): add message editing for user convenience

* chore(i18next): lint

* refactor(i18next): implement context scope

Message#translated was deleted following discussion with maintainers. This commit adds
Message#replyTranslated, Message#editTranslated, Channel#sendTranslated, and implements full
localisation context suites for all of them. It also adds an I18nContext object, which stores
guilds, authors and channels to enable a per-server, per-user and per-channel localisation capacity.

BREAKING CHANGE: All aforementioned changes are breaking.

RE #29

* feat(i18next): augment all channel types

* feat(i18next): augment context and use client

This adds I18nGuildContext, I18nChannelContext, and I18nAuthorContext as
augmentable interfaces. It also changes `#fetchLanguage` to pass the
client instead of binding for performance reasons.

RE #29

* style(i18next): lint

* docs(i18next): document context interfaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants