Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	File size: 1,396 Bytes
			
			| c58df45 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # translations/__init__.py
import logging
from importlib import import_module
logger = logging.getLogger(__name__)
def get_translations(lang_code):
    # Asegurarse de que lang_code sea v谩lido
    if lang_code not in ['es', 'en', 'fr']:
        print(f"Invalid lang_code: {lang_code}. Defaulting to 'es'")
        lang_code = 'es'
    
    try:
        # Importar din谩micamente el m贸dulo de traducci贸n
        translation_module = import_module(f'.{lang_code}', package='translations')
        translations = getattr(translation_module, 'TRANSLATIONS', {})
    except ImportError:
        logger.warning(f"Translation module for {lang_code} not found. Falling back to English.")
        # Importar el m贸dulo de ingl茅s como fallback
        translation_module = import_module('.en', package='translations')
        translations = getattr(translation_module, 'TRANSLATIONS', {})
    def get_text(key, section='COMMON', default=''):
        return translations.get(section, {}).get(key, default)
    return {
        'get_text': get_text,
        **translations.get('COMMON', {}),
        **translations.get('TABS', {}),
        **translations.get('MORPHOSYNTACTIC', {}),
        **translations.get('SEMANTIC', {}),
        **translations.get('DISCOURSE', {}),
        **translations.get('ACTIVITIES', {}),
        **translations.get('FEEDBACK', {})
    } | 
