Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

1.0 KB
Raw Blame
// Build-script view of `lib/i18n.ts`. The Next.js config is TypeScript, so the
// plain-JS build scripts keep their own copy; add a language in both places.
export const DEFAULT_LANGUAGE = "en";
export const LANGUAGES = ["en", "cn"];

/** Suffix a documentation page uses for a language: `faq.mdx` vs `faq.cn.mdx`. */
export function pageSuffix(language) {
  return language === DEFAULT_LANGUAGE ? ".mdx" : `.${language}.mdx`;
}

/** Navigation file for a language: `meta.json` vs `meta.cn.json`. */
export function metaFile(language) {
  return language === DEFAULT_LANGUAGE ? "meta.json" : `meta.${language}.json`;
}

/** Language a documentation file belongs to, from its filename. */
export function languageOfFile(file) {
  const match = file.match(/\.([a-z-]+)\.mdx$/);
  const language = match?.[1];
  return language && LANGUAGES.includes(language) ? language : DEFAULT_LANGUAGE;
}

/** Slug shared by every translation of a page. */
export function slugOfFile(file) {
  return file.replace(new RegExp(`(?:\\.(?:${LANGUAGES.join("|")}))?\\.mdx$`), "");
}