Coverage for src / ezqt_app / domain / ports / translation_service.py: 100.00%

2 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-06 13:12 +0000

1# /////////////////////////////////////////////////////////////// 

2# DOMAIN.PORTS.TRANSLATION_SERVICE - Translation service port 

3# Project: ezqt_app 

4# /////////////////////////////////////////////////////////////// 

5 

6"""Protocol definitions for translation services.""" 

7 

8from __future__ import annotations 

9 

10# /////////////////////////////////////////////////////////////// 

11# IMPORTS 

12# /////////////////////////////////////////////////////////////// 

13# Standard library imports 

14from typing import Protocol 

15 

16 

17# /////////////////////////////////////////////////////////////// 

18# PROTOCOLS 

19# /////////////////////////////////////////////////////////////// 

20class TranslationServiceProtocol(Protocol): 

21 """Technical contract for translation services.""" 

22 

23 def change_language(self, language_name: str) -> bool: 

24 """Switch application language using its display name.""" 

25 

26 def change_language_by_code(self, language_code: str) -> bool: 

27 """Switch application language using its language code.""" 

28 

29 def get_available_languages(self) -> list[str]: 

30 """Return available language codes.""" 

31 

32 def get_current_language_name(self) -> str: 

33 """Return the current language display name.""" 

34 

35 def get_current_language_code(self) -> str: 

36 """Return the current language code.""" 

37 

38 def translate(self, text: str) -> str: 

39 """Translate a text using the active language context."""