Feature:during account initialization, set the interface language to be consistent with the display language(#27029) (#27042)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
feelshana
2025-10-21 15:53:12 +08:00
committed by GitHub
parent 9a9d6a4a2b
commit 2bcf96565a
10 changed files with 33 additions and 13 deletions

View File

@@ -13,7 +13,7 @@ from sqlalchemy.orm import Session
from werkzeug.exceptions import Unauthorized
from configs import dify_config
from constants.languages import language_timezone_mapping, languages
from constants.languages import get_valid_language, language_timezone_mapping
from events.tenant_event import tenant_was_created
from extensions.ext_database import db
from extensions.ext_redis import redis_client, redis_fallback
@@ -1259,7 +1259,7 @@ class RegisterService:
return f"member_invite:token:{token}"
@classmethod
def setup(cls, email: str, name: str, password: str, ip_address: str):
def setup(cls, email: str, name: str, password: str, ip_address: str, language: str):
"""
Setup dify
@@ -1269,11 +1269,10 @@ class RegisterService:
:param ip_address: ip address
"""
try:
# Register
account = AccountService.create_account(
email=email,
name=name,
interface_language=languages[0],
interface_language=get_valid_language(language),
password=password,
is_setup=True,
)
@@ -1315,7 +1314,7 @@ class RegisterService:
account = AccountService.create_account(
email=email,
name=name,
interface_language=language or languages[0],
interface_language=get_valid_language(language),
password=password,
is_setup=is_setup,
)