UNPKG

@gftdcojp/gftd-orm

Version:

Enterprise-grade real-time data platform with ksqlDB, inspired by Supabase architecture

364 lines 9.36 kB
/** * 翻訳クライアント - Weblate統合による多言語対応 */ import { UserPayload } from './types'; /** * 翻訳設定 */ export interface TranslatorConfig { /** Weblate APIエンドポイント */ apiUrl: string; /** Weblate APIキー */ apiKey: string; /** プロジェクトスラッグ */ projectSlug: string; /** コンポーネントスラッグ */ componentSlug: string; /** デフォルト言語 */ defaultLanguage: string; /** サポートする言語 */ supportedLanguages: string[]; /** キャッシュ設定 */ cache?: { enabled: boolean; ttl: number; }; /** テナント固有設定 */ tenantSpecific?: boolean; } /** * 翻訳項目 */ export interface TranslationItem { id: string; key: string; text: string; context?: string; location?: string; flags?: string[]; priority?: number; state?: 'new' | 'needs-editing' | 'translated' | 'approved' | 'readonly'; fuzzy?: boolean; translated?: boolean; approved?: boolean; position?: number; has_suggestion?: boolean; has_comment?: boolean; has_failing_check?: boolean; num_words?: number; readonly?: boolean; timestamp?: string; last_author?: string; pending?: boolean; explanation?: string; extra_flags?: string; web_url?: string; } /** * 翻訳統計 */ export interface TranslationStats { total: number; translated: number; approved: number; readonly: number; fuzzy: number; pending: number; translated_percent: number; approved_percent: number; readonly_percent: number; fuzzy_percent: number; pending_percent: number; last_change?: string; last_author?: string; total_words: number; translated_words: number; approved_words: number; readonly_words: number; fuzzy_words: number; pending_words: number; translated_words_percent: number; approved_words_percent: number; readonly_words_percent: number; fuzzy_words_percent: number; pending_words_percent: number; } /** * 翻訳プロジェクト */ export interface TranslationProject { name: string; slug: string; url: string; web_url: string; source_language: string; components: string[]; languages: string[]; stats: TranslationStats; } /** * 翻訳コンポーネント */ export interface TranslationComponent { name: string; slug: string; url: string; web_url: string; project: string; source_language: string; template: string; file_format: string; filemask: string; stats: TranslationStats; translations: string[]; } /** * 翻訳言語 */ export interface TranslationLanguage { code: string; name: string; direction: 'ltr' | 'rtl'; plural: { id: number; source: number; number: number; formula: string; type: number; }; aliases: string[]; population: number; stats: TranslationStats; } /** * 翻訳クライアント */ export declare class TranslatorClient { private static instance; private config; private permissionChecker; private currentUser; private cache; private constructor(); /** * シングルトンインスタンスを取得 */ static getInstance(config?: TranslatorConfig): TranslatorClient; /** * 設定を更新 */ updateConfig(config: Partial<TranslatorConfig>): void; /** * 現在のユーザーを設定 */ setCurrentUser(user: UserPayload): void; /** * APIリクエストヘルパー */ private apiRequest; /** * キャッシュをクリア */ clearCache(): void; /** * テナント固有のプロジェクトスラッグを取得 */ private getTenantProjectSlug; /** * プロジェクト一覧を取得 */ getProjects(): Promise<TranslationProject[]>; /** * 特定のプロジェクトを取得 */ getProject(projectSlug?: string): Promise<TranslationProject>; /** * コンポーネント一覧を取得 */ getComponents(projectSlug?: string): Promise<TranslationComponent[]>; /** * 特定のコンポーネントを取得 */ getComponent(componentSlug?: string, projectSlug?: string): Promise<TranslationComponent>; /** * 翻訳言語一覧を取得 */ getLanguages(projectSlug?: string): Promise<TranslationLanguage[]>; /** * 翻訳項目を取得 */ getTranslations(language: string, options?: { projectSlug?: string; componentSlug?: string; page?: number; limit?: number; search?: string; state?: string; }): Promise<{ results: TranslationItem[]; count: number; }>; /** * 翻訳項目を更新 */ updateTranslation(translationId: string, target: string, language: string, options?: { projectSlug?: string; componentSlug?: string; state?: string; }): Promise<TranslationItem>; /** * 翻訳統計を取得 */ getTranslationStats(language: string, options?: { projectSlug?: string; componentSlug?: string; }): Promise<TranslationStats>; /** * 翻訳項目を検索 */ searchTranslations(query: string, options?: { language?: string; projectSlug?: string; componentSlug?: string; page?: number; limit?: number; }): Promise<{ results: TranslationItem[]; count: number; }>; /** * 翻訳プロジェクトを作成 */ createProject(project: { name: string; slug: string; source_language: string; web?: string; instructions?: string; set_language_team?: boolean; use_shared_tm?: boolean; contribute_shared_tm?: boolean; access_control?: number; translation_review?: boolean; source_review?: boolean; enable_hooks?: boolean; language_aliases?: string; }): Promise<TranslationProject>; /** * 翻訳コンポーネントを作成 */ createComponent(projectSlug: string, component: { name: string; slug: string; file_format: string; filemask: string; template?: string; edit_template?: boolean; new_lang?: string; language_code_style?: string; source_language?: string; push_on_commit?: boolean; commit_message?: string; add_message?: string; delete_message?: string; merge_message?: string; addon_message?: string; vcs?: string; repo?: string; branch?: string; push_branch?: string; repoweb?: string; git_export?: string; report_source_bugs?: string; license?: string; agreement?: string; allow_translation_propagation?: boolean; save_history?: boolean; enable_suggestions?: boolean; suggestion_voting?: boolean; suggestion_autoaccept?: number; priority?: number; check_flags?: string; enforced_checks?: string[]; commit_pending_age?: number; auto_lock_error?: boolean; language_regex?: string; variant_regex?: string; restricted?: boolean; intermediate?: boolean; template_name?: string; edit_template_name?: string; new_base?: string; intermediate_name?: string; manage_units?: boolean; push_translations?: boolean; }): Promise<TranslationComponent>; /** * 権限をチェック */ private checkPermission; /** * APIキーが必要な操作をチェック */ private checkApiKeyRequired; /** * 翻訳権限をチェック */ checkTranslationPermission(action: 'read' | 'write' | 'manage'): boolean; /** * テナント固有の翻訳プロジェクトを初期化 */ initializeTenantProject(tenantId: string): Promise<TranslationProject>; } /** * 翻訳設定ヘルパー */ export declare const translatorConfig: { /** * 環境変数から設定を構築 */ fromEnv(): TranslatorConfig; /** * 開発環境用の設定 */ development(): TranslatorConfig; /** * 本番環境用の設定 */ production(): TranslatorConfig; }; /** * 翻訳クライアントのヘルパー関数 */ export declare const translator: { /** * クライアントインスタンスを取得 */ client: (config?: TranslatorConfig) => TranslatorClient; /** * 設定を取得 */ config: { /** * 環境変数から設定を構築 */ fromEnv(): TranslatorConfig; /** * 開発環境用の設定 */ development(): TranslatorConfig; /** * 本番環境用の設定 */ production(): TranslatorConfig; }; /** * 翻訳機能を初期化 */ initialize: (config: TranslatorConfig) => TranslatorClient; /** * 現在のユーザーを設定 */ setUser: (user: UserPayload) => void; }; //# sourceMappingURL=translator-client.d.ts.map