@rimori/client 2.2.0-next.1 → 2.2.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/pre-release.yml +21 -0
- package/dist/controller/TranslationController.d.ts +2 -1
- package/dist/controller/TranslationController.js +3 -2
- package/dist/plugin/RimoriClient.js +2 -1
- package/package.json +1 -1
- package/src/controller/TranslationController.ts +4 -2
- package/src/plugin/RimoriClient.ts +2 -2
|
@@ -103,3 +103,24 @@ jobs:
|
|
|
103
103
|
- name: Output published version
|
|
104
104
|
run: |
|
|
105
105
|
echo "✅ Published @rimori/client@${{ steps.version.outputs.new_version }} to npm with @next tag"
|
|
106
|
+
|
|
107
|
+
- name: Notify Slack
|
|
108
|
+
if: always()
|
|
109
|
+
uses: slackapi/slack-github-action@v1.24.0
|
|
110
|
+
with:
|
|
111
|
+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
|
|
112
|
+
payload: |
|
|
113
|
+
{
|
|
114
|
+
"text": "Pre-Release Pipeline Status",
|
|
115
|
+
"blocks": [
|
|
116
|
+
{
|
|
117
|
+
"type": "section",
|
|
118
|
+
"text": {
|
|
119
|
+
"type": "mrkdwn",
|
|
120
|
+
"text": "📦 *@rimori/client Pre-Release*\n\n*Branch:* ${{ github.ref_name }}\n*Version:* ${{ steps.version.outputs.new_version }}\n*Author:* ${{ github.actor }}\n*Pipeline:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>\n\n${{ job.status == 'success' && '✅ Successfully published to npm with @next tag!' || '❌ Pipeline failed. Check the logs for details.' }}"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
env:
|
|
126
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
@@ -7,7 +7,8 @@ export declare class Translator {
|
|
|
7
7
|
private initializationState;
|
|
8
8
|
private initializationPromise;
|
|
9
9
|
private i18n;
|
|
10
|
-
|
|
10
|
+
private translationUrl;
|
|
11
|
+
constructor(initialLanguage: string, translationUrl: string);
|
|
11
12
|
/**
|
|
12
13
|
* Initialize translator with user's language
|
|
13
14
|
* @param userLanguage - Language code from user info
|
|
@@ -12,10 +12,11 @@ import { createInstance } from 'i18next';
|
|
|
12
12
|
* Translator class for handling internationalization
|
|
13
13
|
*/
|
|
14
14
|
export class Translator {
|
|
15
|
-
constructor(initialLanguage) {
|
|
15
|
+
constructor(initialLanguage, translationUrl) {
|
|
16
16
|
this.currentLanguage = initialLanguage;
|
|
17
17
|
this.initializationState = 'not-inited';
|
|
18
18
|
this.initializationPromise = null;
|
|
19
|
+
this.translationUrl = translationUrl;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Initialize translator with user's language
|
|
@@ -66,7 +67,7 @@ export class Translator {
|
|
|
66
67
|
const filename = language !== 'en' ? `local-${language}` : language;
|
|
67
68
|
return `${window.location.origin}/locales/${filename}.json`;
|
|
68
69
|
}
|
|
69
|
-
return
|
|
70
|
+
return `${this.translationUrl}/locales/${language}.json`;
|
|
70
71
|
}
|
|
71
72
|
usePlugin(plugin) {
|
|
72
73
|
if (!this.i18n) {
|
|
@@ -277,7 +277,8 @@ export class RimoriClient {
|
|
|
277
277
|
this.accomplishmentHandler = new AccomplishmentController(info.pluginId);
|
|
278
278
|
this.settingsController = new SettingsController(supabase, info.pluginId, info.guild);
|
|
279
279
|
this.sharedContentController = new SharedContentController(supabase, this);
|
|
280
|
-
|
|
280
|
+
const currentPlugin = info.installedPlugins.find((plugin) => plugin.id === info.pluginId);
|
|
281
|
+
this.translator = new Translator(info.interfaceLanguage, (currentPlugin === null || currentPlugin === void 0 ? void 0 : currentPlugin.endpoint) || '');
|
|
281
282
|
//only init logger in workers and on main plugin pages
|
|
282
283
|
if (this.getQueryParam('applicationMode') !== 'sidebar') {
|
|
283
284
|
Logger.getInstance(this);
|
package/package.json
CHANGED
|
@@ -10,11 +10,13 @@ export class Translator {
|
|
|
10
10
|
private initializationState: InitializationState;
|
|
11
11
|
private initializationPromise: Promise<void> | null;
|
|
12
12
|
private i18n: i18nType | undefined;
|
|
13
|
+
private translationUrl: string;
|
|
13
14
|
|
|
14
|
-
constructor(initialLanguage: string) {
|
|
15
|
+
constructor(initialLanguage: string, translationUrl: string) {
|
|
15
16
|
this.currentLanguage = initialLanguage;
|
|
16
17
|
this.initializationState = 'not-inited';
|
|
17
18
|
this.initializationPromise = null;
|
|
19
|
+
this.translationUrl = translationUrl;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -72,7 +74,7 @@ export class Translator {
|
|
|
72
74
|
return `${window.location.origin}/locales/${filename}.json`;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
return
|
|
77
|
+
return `${this.translationUrl}/locales/${language}.json`;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
public usePlugin(plugin: ThirdPartyModule): void {
|
|
@@ -43,7 +43,8 @@ export class RimoriClient {
|
|
|
43
43
|
this.accomplishmentHandler = new AccomplishmentController(info.pluginId);
|
|
44
44
|
this.settingsController = new SettingsController(supabase, info.pluginId, info.guild);
|
|
45
45
|
this.sharedContentController = new SharedContentController(supabase, this);
|
|
46
|
-
|
|
46
|
+
const currentPlugin = info.installedPlugins.find((plugin) => plugin.id === info.pluginId);
|
|
47
|
+
this.translator = new Translator(info.interfaceLanguage, currentPlugin?.endpoint || '');
|
|
47
48
|
|
|
48
49
|
//only init logger in workers and on main plugin pages
|
|
49
50
|
if (this.getQueryParam('applicationMode') !== 'sidebar') {
|
|
@@ -484,4 +485,3 @@ export class RimoriClient {
|
|
|
484
485
|
},
|
|
485
486
|
};
|
|
486
487
|
}
|
|
487
|
-
|