feat(i18n): localize start/help/menu, practice, words, import, reminder, vocabulary, tasks/stats for RU/EN/JA; add JSON-based i18n helper\n\nfeat(lang): support learning/translation languages across AI flows; hide translations with buttons; store examples per lang\n\nfeat(vocab): add source_lang and translation_lang to Vocabulary, unique constraint (user_id, source_lang, word_original); filter /vocabulary by user.learning_language\n\nchore(migrations): add Alembic setup + migration to add vocab lang columns; env.py reads app settings and supports asyncpg URLs\n\nfix(words/import): pass learning_lang + translation_lang everywhere; fix menu themes generation\n\nfeat(settings): add learning language selector; update main menu on language change
This commit is contained in:
30
migrations/versions/20251204_add_vocab_lang_fields.py
Normal file
30
migrations/versions/20251204_add_vocab_lang_fields.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""add source_lang and translation_lang to vocabulary
|
||||
|
||||
Revision ID: 20251204_add_vocab_lang
|
||||
Revises:
|
||||
Create Date: 2025-12-04
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '20251204_add_vocab_lang'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('vocabulary', sa.Column('source_lang', sa.String(length=5), nullable=True))
|
||||
op.add_column('vocabulary', sa.Column('translation_lang', sa.String(length=5), nullable=True))
|
||||
# Create unique constraint for (user_id, source_lang, word_original)
|
||||
op.create_unique_constraint('uq_vocab_user_lang_word', 'vocabulary', ['user_id', 'source_lang', 'word_original'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint('uq_vocab_user_lang_word', 'vocabulary', type_='unique')
|
||||
op.drop_column('vocabulary', 'translation_lang')
|
||||
op.drop_column('vocabulary', 'source_lang')
|
||||
|
||||
Reference in New Issue
Block a user