Skip to content

Commit a8818d2

Browse files
committed
Merge branch 'main' of github.com:devforth/adminforth
2 parents 4c7b5fa + 31aef0c commit a8818d2

File tree

7 files changed

+18
-7
lines changed

7 files changed

+18
-7
lines changed

adminforth/documentation/docs/tutorial/05-Plugins/10-i18n.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Sometimes you might want to have HTML in translations. You can use `v-html` dire
276276
v-html='$t("<span class=\"text-transparent bg-clip-text bg-gradient-to-r to-emerald-600 from-sky-400\">Apartments</span> Statistics.")'></h1>
277277
```
278278
279-
> 🪪 Please keep in mind that roles who have access to translations resource can make HTML injections, though anyway if you are using [Audit Log](/docs/tutorial/Plugins/AuditLog/) plugin you can track all changes in translations and understand who made them.
279+
> 🪪 Security alert. Please keep in mind that if you are using `v-html="$t(`, the roles who have access to translations resource can make HTML/XSS injections, though anyway if you are using [Audit Log](/docs/tutorial/Plugins/AuditLog/) plugin you can track all changes in translations and understand who made them.
280280

281281
### Pluralization
282282

adminforth/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adminforth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adminforth",
3-
"version": "1.5.8-next.12",
3+
"version": "1.5.8-next.13",
44
"description": "OpenSource Vue3 powered forth-generation admin panel",
55
"main": "dist/index.js",
66
"module": "dist/index.js",

adminforth/plugins/i18n/custom/langCommon.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const countryISO31661ByLangISO6391 = {
5454
ko: 'kr', // Korean → South Korea
5555
ja: 'jp', // Japanese → Japan
5656
uk: 'ua', // Ukrainian → Ukraine
57+
ur: 'pk', // Urdu → Pakistan
5758
};
5859

5960
export function getCountryCodeFromLangCode(langCode) {

adminforth/plugins/i18n/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@ export default class I18N extends AdminForthPlugin {
234234
return { ok: true };
235235
});
236236

237+
// add hook on delete of any translation to reset cache
238+
resourceConfig.hooks.delete.afterSave.push(async ({ record }: { record: any }): Promise<{ ok: boolean, error?: string }> => {
239+
for (const lang of this.options.supportedLanguages) {
240+
this.cache.clear(`${this.resourceConfig.resourceId}:frontend:${lang}`);
241+
this.cache.clear(`${this.resourceConfig.resourceId}:${record[this.options.categoryFieldName]}:${lang}:${record[this.enFieldName]}`);
242+
}
243+
this.updateUntranslatedMenuBadge();
244+
return { ok: true };
245+
});
246+
237247
if (this.options.completedFieldName) {
238248
// on show and list add a list hook which will add incomplete field to record if translation is missing for at least one language
239249
const addIncompleteField = (record: any) => {

adminforth/plugins/i18n/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adminforth/plugins/i18n/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adminforth/i18n",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"type": "module",

0 commit comments

Comments
 (0)