Add Russian i18n with DB translations, locale API, and curator review UI.
UI chrome via react-i18next, catalog text in entity_translations with ru.wikipedia seeding, locale-aware search, and Translations page for publish workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
f247b418d8
commit
ca58c43648
@@ -0,0 +1,36 @@
|
||||
-- Internationalization: locale-specific catalog text (canonical English stays in main tables).
|
||||
|
||||
CREATE TABLE IF NOT EXISTS entity_translations (
|
||||
id SERIAL PRIMARY KEY,
|
||||
entity_type VARCHAR(32) NOT NULL,
|
||||
entity_id INTEGER NOT NULL,
|
||||
locale VARCHAR(10) NOT NULL,
|
||||
field_name VARCHAR(64) NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'draft',
|
||||
source VARCHAR(120),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
UNIQUE (entity_type, entity_id, locale, field_name)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS entity_translations_lookup_idx
|
||||
ON entity_translations (entity_type, entity_id, locale);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS entity_translations_locale_field_idx
|
||||
ON entity_translations (locale, field_name);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS entity_translations_value_lower_idx
|
||||
ON entity_translations (locale, lower(value));
|
||||
|
||||
CREATE OR REPLACE FUNCTION entity_translations_touch_updated_at()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = now();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
DROP TRIGGER IF EXISTS entity_translations_updated_at ON entity_translations;
|
||||
CREATE TRIGGER entity_translations_updated_at
|
||||
BEFORE UPDATE ON entity_translations
|
||||
FOR EACH ROW EXECUTE PROCEDURE entity_translations_touch_updated_at();
|
||||
Reference in New Issue
Block a user