Skip to content

Commit 1f990da

Browse files
committed
Merge branch 'main' of github.com:devforth/adminforth-i18n
2 parents 45d3873 + 6b3b9e8 commit 1f990da

20 files changed

Lines changed: 7982 additions & 428 deletions

.woodpecker/buildRelease.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
#!/bin/bash
3+
4+
# write npm run output both to console and to build.log
5+
npm run build 2>&1 | tee build.log
6+
build_status=${PIPESTATUS[0]}
7+
8+
# if exist status from the npm run build is not 0
9+
# then exit with the status code from the npm run build
10+
if [ $build_status -ne 0 ]; then
11+
echo "Build failed. Exiting with status code $build_status"
12+
exit $build_status
13+
fi

.woodpecker/buildSlackNotify.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
4+
COMMIT_SHORT_SHA=$(echo $CI_COMMIT_SHA | cut -c1-8)
5+
6+
7+
if [ "$CI_STEP_STATUS" = "success" ]; then
8+
MESSAGE="Did a build without issues on \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\`. Commit: _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
9+
10+
curl -s -X POST -H "Content-Type: application/json" -d '{
11+
"username": "'"$CI_COMMIT_AUTHOR"'",
12+
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
13+
"attachments": [
14+
{
15+
"mrkdwn_in": ["text", "pretext"],
16+
"color": "#36a64f",
17+
"text": "'"$MESSAGE"'"
18+
}
19+
]
20+
}' "$DEVELOPERS_SLACK_WEBHOOK"
21+
exit 0
22+
fi
23+
export BUILD_LOG=$(cat ./build.log)
24+
25+
26+
MESSAGE="Broke \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\` with commit _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
27+
CODE_BLOCK="\`\`\`$BUILD_LOG\n\`\`\`"
28+
29+
echo "Sending slack message to developers $MESSAGE"
30+
# Send the message
31+
curl -X POST -H "Content-Type: application/json" -d '{
32+
"username": "'"$CI_COMMIT_AUTHOR"'",
33+
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
34+
"attachments": [
35+
{
36+
"mrkdwn_in": ["text", "pretext"],
37+
"color": "#8A1C12",
38+
"text": "'"$CODE_BLOCK"'",
39+
"pretext": "'"$MESSAGE"'"
40+
}
41+
]
42+
}' "$DEVELOPERS_SLACK_WEBHOOK"

.woodpecker/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
clone:
2+
git:
3+
image: woodpeckerci/plugin-git
4+
settings:
5+
partial: false
6+
depth: 5
7+
8+
steps:
9+
init-secrets:
10+
when:
11+
- event: push
12+
image: infisical/cli
13+
environment:
14+
INFISICAL_TOKEN:
15+
from_secret: VAULT_TOKEN
16+
commands:
17+
- infisical export --domain https://vault.devforth.io/api --format=dotenv-export --env="prod" > /woodpecker/deploy.vault.env
18+
19+
release:
20+
image: node:20
21+
when:
22+
- event: push
23+
volumes:
24+
- /var/run/docker.sock:/var/run/docker.sock
25+
commands:
26+
# install rsync
27+
- apt update && apt install -y rsync
28+
- export $(cat /woodpecker/deploy.vault.env | xargs)
29+
- npm clean-install
30+
- /bin/bash ./.woodpecker/buildRelease.sh
31+
- npm audit signatures
32+
- npx semantic-release
33+
34+
slack-on-failure:
35+
when:
36+
- event: push
37+
status: [failure, success]
38+
- event: push
39+
image: curlimages/curl
40+
commands:
41+
- export $(cat /woodpecker/deploy.vault.env | xargs)
42+
- /bin/sh ./.woodpecker/buildSlackNotify.sh
43+

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# Changelog
3+
4+
The complete changelog is available on the [GitHub Releases page](https://github.com/devforth/adminforth-i18n/releases).
5+

Changelog.md

Lines changed: 0 additions & 71 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# AdminForth i18n Plugin
2+
3+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /> <img src="https://woodpecker.devforth.io/api/badges/3848/status.svg" alt="Build Status" /> <a href="https://www.npmjs.com/package/@adminforth/i18n"> <img src="https://img.shields.io/npm/dt/@adminforth/i18n" alt="npm downloads" /></a> <a href="https://www.npmjs.com/package/@adminforth/i18n"><img src="https://img.shields.io/npm/v/@adminforth/i18n" alt="npm version" /></a> <a href="https://www.npmjs.com/package/@adminforth/i18n">
4+
5+
Allows to store all translation strings in an adminforth application in a single resource.
6+
7+
## For ussage, see [AdminForth i18n Documentation](https://adminforth.dev/docs/tutorial/Plugins/i18n/)

custom/LanguageEveryPageLoader.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template/>
2+
3+
<script setup>
4+
import { onMounted } from 'vue';
5+
import { useI18n } from 'vue-i18n';
6+
import { setLang, getLocalLang } from './langCommon';
7+
8+
const { setLocaleMessage, locale } = useI18n();
9+
10+
const props = defineProps(['meta']);
11+
12+
onMounted(() => {
13+
setLang({ setLocaleMessage, locale }, props.meta.pluginInstanceId, getLocalLang(props.meta.supportedLanguages));
14+
});
15+
</script>

custom/LanguageInUserMenu.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ const selectedOption = computed(() => {
8888
8989
9090
onMounted(() => {
91-
console.log('Language In user menu mounted', props.meta.supportedLanguages);
9291
selectedLanguage.value = getLocalLang(props.meta.supportedLanguages);
93-
setLang({ setLocaleMessage, locale }, props.meta.pluginInstanceId, selectedLanguage.value);
94-
// todo this mounted executed only on this component mount, f5 from another page apart login will not read it
9592
});
9693
</script>

custom/LanguageUnderLogin.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ const options = computed(() => {
6262
});
6363
6464
onMounted(() => {
65-
console.log('LanguageUnderLogin mounted', props.meta.supportedLanguages);
6665
selectedLanguage.value = getLocalLang(props.meta.supportedLanguages);
67-
setLang({ setLocaleMessage, locale }, props.meta.pluginInstanceId, selectedLanguage.value);
68-
// todo this mounted executed only on this component mount, f5 from another page apart login will not read it
6966
});
70-
7167
</script>

0 commit comments

Comments
 (0)