def get_translation(text, language): translated = gtranslator.translate(text, dest=[language]) if language == 'en': translated = get_with_alias().get(text) or translated return translated
def test_get_with_alias(c, monkeypatch): office = 't_office' task = 't_task' ticket = 't_ticket' aliases = Aliases.get() aliases.office = office aliases.task = task aliases.ticket = ticket db.session.commit() alt_aliases = get_with_alias(DB_NAME) assert office in alt_aliases.get('\nOffice : ') assert ticket in alt_aliases.get('\nCurrent ticket : ') assert task in alt_aliases.get('\nTask : ')