Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"Coolify",
"devapps",
"DOKPLOY",
"effectify",
"foldertree",
"frontmatter",
"genpkey",
Expand Down
22 changes: 2 additions & 20 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { devServerFileWatcher } from './src/integrations/dev-file-watcher.ts';
import { remarkFallbackLang } from './src/plugins/remark-fallback-pages.ts';
import starlightLlmsTxt from 'starlight-llms-txt';
import { unified } from "@astrojs/markdown-remark";
import { starlightLocales } from './i18n';

// Define the Site URL
const site = process.env.DOKPLOY_DEPLOY_URL
Expand All @@ -27,25 +28,6 @@ const linkValidator = process.env.CHECK_LINKS
]
: [];

export const locales = {
en: { label: 'English', lang: 'en' },
es: { label: 'Español', lang: 'es' },
de: { label: 'Deutsch', lang: 'de' },
// ja: { label: '日本語', lang: 'ja' },
fr: { label: 'Français', lang: 'fr' },
// it: { label: 'Italiano', lang: 'it' },
// id: { label: 'Bahasa Indonesia', lang: 'id' },
'zh-cn': { label: '简体中文', lang: 'zh-CN' },
// 'pt-br': { label: 'Português do Brasil', lang: 'pt-BR' },
// 'pt-pt': { label: 'Português', lang: 'pt-PT' },
ko: { label: '한국어', lang: 'ko' },
// tr: { label: 'Türkçe', lang: 'tr' },
// ru: { label: 'Русский', lang: 'ru' },
// hi: { label: 'हिंदी', lang: 'hi' },
// da: { label: 'Dansk', lang: 'da' },
// uk: { label: 'Українська', lang: 'uk' },
};

export default defineConfig({
site,
image: {
Expand Down Expand Up @@ -102,7 +84,7 @@ export default defineConfig({
light: './assets/logo-dark.svg',
},
defaultLocale: 'en',
locales,
locales: starlightLocales,
social: [
{ label: 'GitHub', icon: 'github', href: 'https://github.com/withstudiocms/studiocms' },
{ label: 'Discord', icon: 'discord', href: 'https://chat.studiocms.dev' },
Expand Down
98 changes: 98 additions & 0 deletions i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import type { Locale } from "@lunariajs/core";

type CommonLocale = {
label: string;
lang: string;
parameters: {
tag: string;
};
};

type StarlightLocale = {
label: string;
lang: string;
};

type StarlightLocaleMap = Record<string, StarlightLocale>;

export const locales: CommonLocale[] = [
{
label: 'English',
lang: 'en',
parameters: {
tag: 'en',
},
},
{
label: 'Español',
lang: 'es',
parameters: {
tag: 'es',
},
},
{
label: 'Français',
lang: 'fr',
parameters: {
tag: 'fr',
},
},
{
label: 'Deutsch',
lang: 'de',
parameters: {
tag: 'de',
},
},
{
label: '简体中文',
lang: 'zh-cn',
parameters: {
tag: 'zh-CN',
},
},
{
label: '한국어',
lang: 'ko',
parameters: {
tag: 'ko',
},
},
]

function toStarlightLocale(commonLocale: CommonLocale): StarlightLocale {
return {
label: commonLocale.label,
lang: commonLocale.parameters.tag,
};
}

function toStarlightLocaleMap(commonLocales: CommonLocale[]): StarlightLocaleMap {
const starlightLocaleMap: StarlightLocaleMap = {};
for (const commonLocale of commonLocales) {
starlightLocaleMap[commonLocale.lang] = toStarlightLocale(commonLocale);
}
return starlightLocaleMap;
}

function toLunariaLocale(commonLocale: CommonLocale): Locale {
return {
label: commonLocale.label,
lang: commonLocale.lang,
parameters: commonLocale.parameters,
};
}

function toLunariaLocales(commonLocales: CommonLocale[]): [Locale, ...Locale[]] {
const lunariaLocales: Locale[] = commonLocales.map(toLunariaLocale)
// Filter out the source locale (English) for Lunaria, since it is already defined in the config
.filter((locale) => locale.lang !== 'en');
if (lunariaLocales.length === 0) {
throw new Error("No locales provided");
}
return [lunariaLocales[0], ...lunariaLocales.slice(1)];
}

export const lunariaLocales: [Locale, ...Locale[]] = toLunariaLocales(locales);

export const starlightLocales: StarlightLocaleMap = toStarlightLocaleMap(locales);
3 changes: 1 addition & 2 deletions knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const config: KnipConfig = {
'@withstudiocms/component-registry',
'@withstudiocms/kysely',
"@withstudiocms/effect",
'@studiocms/web-vitals',
'astro-integration-kit'
"@effect/cli"
],
entry: [
'src/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
Expand Down
109 changes: 2 additions & 107 deletions lunaria.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { html } from '@lunariajs/core';
import { defineConfig } from '@lunariajs/core/config';
import { lunariaLocales } from './i18n';

export default defineConfig({
repository: {
Expand All @@ -14,113 +15,7 @@ export default defineConfig({
tag: 'en',
},
},
locales: [
{
label: 'Español',
lang: 'es',
parameters: {
tag: 'es',
},
},
{
label: 'Français',
lang: 'fr',
parameters: {
tag: 'fr',
},
},
{
label: 'Deutsch',
lang: 'de',
parameters: {
tag: 'de',
},
},
// {
// label: '日本語',
// lang: 'ja',
// parameters: {
// tag: 'ja',
// },
// },
// {
// label: 'Italiano',
// lang: 'it',
// parameters: {
// tag: 'it',
// },
// },
// {
// label: 'Bahasa Indonesia',
// lang: 'id',
// parameters: {
// tag: 'id',
// },
// },
{
label: '简体中文',
lang: 'zh-cn',
parameters: {
tag: 'zh-CN',
},
},
// {
// label: 'Português do Brasil',
// lang: 'pt-br',
// parameters: {
// tag: 'pt-BR',
// },
// },
// {
// label: 'Português',
// lang: 'pt-pt',
// parameters: {
// tag: 'pt-PT',
// },
// },
{
label: '한국어',
lang: 'ko',
parameters: {
tag: 'ko',
},
},
// {
// label: 'Türkçe',
// lang: 'tr',
// parameters: {
// tag: 'tr',
// },
// },
// {
// label: 'Русский',
// lang: 'ru',
// parameters: {
// tag: 'ru',
// },
// },
// {
// label: 'हिंदी',
// lang: 'hi',
// parameters: {
// tag: 'hi',
// },
// },
// {
// label: 'Dansk',
// lang: 'da',
// parameters: {
// tag: 'da',
// },
// },
// {
// label: 'Українська',
// lang: 'uk',
// parameters: {
// tag: 'uk',
// },
// },
],
locales: lunariaLocales,
files: [
{
include: ['src/content/i18n/*.json'],
Expand Down
39 changes: 21 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,27 @@
"gen-changelogs": "tsm --require=./scripts/filter-warnings.cjs ./scripts/generate-release-notes.ts"
},
"dependencies": {
"@studiocms/blog": "^0.3.0",
"@studiocms/cloudinary-image-service": "^0.3.0",
"@studiocms/devapps": "^0.3.0",
"@studiocms/html": "^0.3.0",
"@studiocms/markdoc": "^0.3.0",
"@studiocms/md": "^0.3.0",
"@studiocms/mdx": "^0.3.0",
"@studiocms/s3-storage": "^0.3.0",
"@studiocms/wysiwyg": "^0.3.0",
"@withstudiocms/api-spec": "^0.3.0",
"@withstudiocms/component-registry": "^0.1.4",
"@withstudiocms/effect": "^0.4.0",
"@withstudiocms/kysely": "^0.2.1",
"@withstudiocms/sdk": "^0.3.0",
"@withstudiocms/template-lang": "^0.1.0",
"effectify": "^0.1.0",
"studiocms": "^0.4.0",
"@studiocms/blog": "^0.4.0",
"@studiocms/cloudinary-image-service": "^0.4.0",
"@studiocms/devapps": "^0.4.0",
"@studiocms/html": "^0.4.0",
"@studiocms/markdoc": "^0.4.0",
"@studiocms/md": "^0.4.0",
"@studiocms/mdx": "^0.4.0",
"@studiocms/s3-storage": "^0.4.0",
"@studiocms/wysiwyg": "^0.4.0",
"@withstudiocms/api-spec": "^0.4.0",
"@withstudiocms/component-registry": "^0.2.0",
"@withstudiocms/effect": "^0.5.0",
"@withstudiocms/kysely": "^0.3.0",
"@withstudiocms/sdk": "^0.4.0",
"@withstudiocms/template-lang": "^0.2.0",
"effectify": "^0.3.0",
"studiocms": "^0.5.0",
"effect": "^3.22.1",
"@effect/cli": "^0.77.0",
"@effect/platform": "^0.97.1",
"@effect/platform-node": "^0.108.1",

"@11ty/eleventy-fetch": "^5.0.2",
"@actions/core": "^3.0.0",
Expand All @@ -59,7 +63,6 @@
"@types/semver": "^7.7.0",
"astro": "^7.2.9",
"astro-embed": "^0.14.0",
"effect": "^3.19.19",
"fast-glob": "^3.3.3",
"hast-util-to-string": "^3.0.1",
"hastscript": "^9.0.1",
Expand Down
Loading
Loading