Skip to content

Commit

Permalink
refactor: required language code on url + revert fa as language fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
gozarman committed Mar 15, 2024
1 parent d671f3e commit 5eccbb5
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion marzban/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default defineConfig({
cleanUrls: true,
lang: 'fa',
locales: {
root: englishLang,
// root: englishLang,
fa: {
...persianLang,
link: '/fa/',
Expand Down
4 changes: 2 additions & 2 deletions marzban/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ html[dir] {
line-height: 1.2;
}

a.VPLink.link[href^="/marzban/en/"] {
/* a.VPLink.link[href^="/marzban/fa/"] {
display: none;
}
} */

.VPImage.logo {
margin-right: 10px;
Expand Down
12 changes: 6 additions & 6 deletions marzban/[path].paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ const developmentContent = (location) => `
<script setup>
import {withBase, useRouter} from 'vitepress'
const {go} = useRouter();
console.log(go)
go(withBase('/en/${location}'))
const { go } = useRouter();
go(withBase('/fa/${location}'))
</script>
`

export default {
async paths() {
return walk('./marzban/en').map((filePath) => {
const path = filePath.replace('./marzban/en/', '').replace('.md', '')
return walk('./marzban/fa').map((filePath) => {
const path = filePath.replace('./marzban/fa/', '').replace('.md', '')
return {
params: { path },
content: process.env.NODE_ENV === 'development' ? developmentContent(path) : fs.readFileSync(filePath, { encoding: 'utf8' }),
content: developmentContent(path),
}
})
},
Expand Down
48 changes: 24 additions & 24 deletions marzban/en/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,51 @@ export const config = {
items: [
{
text: 'Introduction',
link: '/docs/introduction',
link: '/en/docs/introduction',
},
{
text: 'Getting started',
link: '/docs/installation',
link: '/en/docs/installation',
},
{
text: 'Configuration',
link: '/docs/configuration',
link: '/en/docs/configuration',
},
],
},
{
text: 'Documentation',
items: [
{ text: 'Host settings', link: '/docs/host-settings' },
{ text: 'Subscriptions', link: '/docs/subscription' },
{ text: 'Marzban node ✨', link: '/docs/marzban-node' },
{ text: 'Telegram bot', link: '/docs/telegram-bot' },
{ text: 'Marzban script', link: '/docs/marzban-script' },
{ text: 'CLI', link: '/docs/marzban-cli' },
{ text: 'API', link: '/docs/api' },
{ text: 'Webhook', link: '/docs/webhook' },
{ text: 'Host settings', link: '/en/docs/host-settings' },
{ text: 'Subscriptions', link: '/en/docs/subscription' },
{ text: 'Marzban node ✨', link: '/en/docs/marzban-node' },
{ text: 'Telegram bot', link: '/en/docs/telegram-bot' },
{ text: 'Marzban script', link: '/en/docs/marzban-script' },
{ text: 'CLI', link: '/en/docs/marzban-cli' },
{ text: 'API', link: '/en/docs/api' },
{ text: 'Webhook', link: '/en/docs/webhook' },
],
},
{
text: 'Tutorials',
items: [
{ text: 'How to generate SSL', link: '/examples/issue-ssl-certificate' },
{ text: 'Activating SSL in Marzban', link: '/examples/marzban-ssl' },
{ text: 'Activating TLS', link: '/examples/xray-tls-inbound' },
{ text: 'REALITY guide', link: '/examples/all-on-one-port' },
{ text: 'Cloudflare Warp setup', link: '/examples/warp' },
{ text: 'Rules configuration', link: '/examples/blocking-rules' },
{ text: 'All on one port', link: '/examples/all-on-one-port' },
{ text: 'MySQL setup', link: '/examples/mysql' },
{ text: 'Backup', link: '/examples/backup' },
{ text: 'Change Xray-core', link: '/examples/change-xray-version' },
{ text: 'How to generate SSL', link: '/en/examples/issue-ssl-certificate' },
{ text: 'Activating SSL in Marzban', link: '/en/examples/marzban-ssl' },
{ text: 'Activating TLS', link: '/en/examples/xray-tls-inbound' },
{ text: 'REALITY guide', link: '/en/examples/all-on-one-port' },
{ text: 'Cloudflare Warp setup', link: '/en/examples/warp' },
{ text: 'Rules configuration', link: '/en/examples/blocking-rules' },
{ text: 'All on one port', link: '/en/examples/all-on-one-port' },
{ text: 'MySQL setup', link: '/en/examples/mysql' },
{ text: 'Backup', link: '/en/examples/backup' },
{ text: 'Change Xray-core', link: '/en/examples/change-xray-version' },
],
},
],
nav: [
{ text: 'Home', link: '/' },
{ text: 'Docs', link: '/docs/introduction' },
{ text: 'Examples', link: '/examples/issue-ssl-certificate' },
{ text: 'Home', link: '/en/' },
{ text: 'Docs', link: '/en/docs/introduction' },
{ text: 'Examples', link: '/en/examples/issue-ssl-certificate' },
],

footer: {
Expand Down
4 changes: 2 additions & 2 deletions marzban/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ hero:
actions:
- theme: brand
text: Get started
link: './documentation/'
link: './docs/introduction'
- theme: alt
text: Examples
link: './examples/'
link: './examples/issue-ssl-certificate'

features:
- icon: 💎
Expand Down
2 changes: 1 addition & 1 deletion marzban/fa/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const config: DefaultTheme.Config = {
title: 'صفحه مورد نظر پیدا نشد',
quote: 'برای مشاهده مستندات، به صفحه اصلی مراجعه کنید. برای پیدا کردن مطلب مورد نظر میتوانید از قابلیت جستجو استفاده کنید.',
linkText: 'مطالعه مستندات',
linkLabel: '/marzban/',
linkLabel: '/marzban/fa',
},
darkModeSwitchLabel: 'رنگبندی',
darkModeSwitchTitle: 'تاریک',
Expand Down
2 changes: 1 addition & 1 deletion marzban/fa/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ hero:
link: './docs/introduction'
- theme: alt
text: نمونه‌ها
link: './examples/'
link: './examples/issue-ssl-certificate'

features:
- icon: 💎
Expand Down

0 comments on commit 5eccbb5

Please sign in to comment.