Skip to content

Commit

Permalink
feat: set en as default language
Browse files Browse the repository at this point in the history
  • Loading branch information
gozarman committed Mar 14, 2024
1 parent f459ade commit 00dd776
Show file tree
Hide file tree
Showing 30 changed files with 3,706 additions and 968 deletions.
21 changes: 14 additions & 7 deletions marzban/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { defineConfig } from 'vitepress'
import { DefaultTheme, LocaleSpecificConfig, defineConfig } from 'vitepress'
import englishThemeConfig from '../en/config'
import persianThemeConfig from '../fa/config'

type ThemeConfig = LocaleSpecificConfig<DefaultTheme.Config> & { label: string; link?: string }

export const BASE = '/marzban'

const persianLang = {
const persianLang: ThemeConfig = {
label: 'فارسی',
lang: 'fa',
dir: 'rtl',
Expand All @@ -14,12 +16,12 @@ const persianLang = {
themeConfig: persianThemeConfig,
}

const englishLang = {
const englishLang: ThemeConfig = {
title: 'Marzban',
description: '',
label: 'English',
lang: 'en',
link: '/en/',
link: '/',
themeConfig: englishThemeConfig,
}

Expand All @@ -31,17 +33,22 @@ export default defineConfig({
cleanUrls: true,
lang: 'fa',
locales: {
root: persianLang,
root: englishLang,
fa: {
...persianLang,
link: '/fa/',
},
en: englishLang,
en: { ...englishLang, link: '/en/' },
},
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
i18nRouting: true,
logo: '/images/logo-dark.png',
socialLinks: [{ icon: 'github', link: 'https://github.com/gozargah/marzban' }],
search: {
provider: 'local',
},
},
sitemap: {
hostname: 'https://gozargah.github.io',
},
})
2 changes: 1 addition & 1 deletion marzban/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ html[dir] {
line-height: 1.2;
}

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

Expand Down
7 changes: 3 additions & 4 deletions marzban/[path].paths.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fs from 'fs'
import * as v from 'vitepress'

var walk = function (dir) {
var results = []
Expand All @@ -22,14 +21,14 @@ import {withBase, useRouter} from 'vitepress'
const {go} = useRouter();
console.log(go)
go(withBase('/fa/${location}'))
go(withBase('/en/${location}'))
</script>
`

export default {
async paths() {
return walk('./marzban/fa').map((filePath) => {
const path = filePath.replace('./marzban/fa/', '').replace('.md', '')
return walk('./marzban/en').map((filePath) => {
const path = filePath.replace('./marzban/en/', '').replace('.md', '')
return {
params: { path },
content: process.env.NODE_ENV === 'development' ? developmentContent(path) : fs.readFileSync(filePath, { encoding: 'utf8' }),
Expand Down
74 changes: 0 additions & 74 deletions marzban/en/config.js

This file was deleted.

71 changes: 71 additions & 0 deletions marzban/en/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
export const config = {
sidebar: [
{
text: 'Overview',
items: [
{
text: 'Introduction',
link: '/docs/introduction',
},
{
text: 'Getting started',
link: '/docs/installation',
},
{
text: 'Configuration',
link: '/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: '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' },
],
},
],
nav: [
{ text: 'Home', link: '/' },
{ text: 'Docs', link: '/docs/introduction' },
{ text: 'Examples', link: '/examples/issue-ssl-certificate' },
],

footer: {
message: 'Released under AGPL-3.0 License.',
copyright: 'Copyright © 2023-present Gozargah',
},
editLink: {
pattern: 'https://github.com/gozargah/gozargah.github.io/edit/master/marzban/en/:path',
text: 'Edit this page on GitHub',
},
notFound: {
title: 'PAGE NOT FOUND',
quote: "But if you don't change your direction, and if you keep looking, you may end up where you are heading.",
linkText: 'Go to docs',
linkLabel: '/marzban/en',
},
}

export default config
File renamed without changes.
Loading

0 comments on commit 00dd776

Please sign in to comment.