def handler_letter_saved(sender, **kwargs): """Generate code to translate letters.""" # pylint: disable=unused-argument strings = [] for letter in Letter.objects.order_by('priority'): strings.append((letter.content, f'Letter: {letter.description}')) i18n_autogen('w3blacklist', 'letter', strings)
def handler_project_saved(sender, **kwargs): """Generate code to translate projects.""" # pylint: disable=unused-argument strings = [] for project in Project.objects.order_by('priority'): strings.append(project.description) strings.append(project.support) i18n_autogen('home', 'project', strings)
def handler_modem_saved(sender, **kwargs): """Generate code to translate modems.""" # pylint: disable=unused-argument strings = [] for modem in Modem.objects.order_by('manufacturer', 'modem'): if modem.comment: strings.append( ( modem.comment, f'comment for modem {modem.manufacturer} {modem.modem}', ) ) i18n_autogen('eciadsl', 'modem', strings)
def handler_info_saved(sender, **kwargs): """Generate code to translate news.""" # pylint: disable=unused-argument strings = [] for info in Info.objects.order_by('-date'): translators = str(info) match = PATTERN_TITLE_VERSION.match(info.title) if match: # if the title is "Version x.y.z", translate only "Version" strings.append((match.group(1), translators)) else: strings.append((info.title, translators)) if info.text: strings.append((info.text, translators)) i18n_autogen('news', 'info', strings)
def handler_program_saved(sender, **kwargs): """Generate code to translate programs.""" # pylint: disable=unused-argument strings_categ = [] strings_lang = [] strings = [] for prog in Program.objects.order_by('category', 'name'): strings_categ.append(prog.category.capitalize()) strings_lang.append((prog.prog_language, 'Programming language')) strings.append( (prog.shortdesc, f'short description for program "{prog.name}"')) strings.append( (prog.description, f'description for program "{prog.name}"')) strings.append((prog.filename_description, f'filename description for program "{prog.name}"')) i18n_autogen('coding', 'program', strings_categ + strings_lang + strings)
def handler_site_saved(sender, **kwargs): """Generate code to translate sites.""" # pylint: disable=unused-argument strings = [] for site in Site.objects.order_by('-date', 'website'): if site.status not in (2, 3): # status is not blacklisted or fixed continue strings.append(( site.shortdesc, f'short description for site {site.website} ({site.url})', )) if site.description: strings.append(( site.description, f'description for site {site.website} ({site.url})', )) i18n_autogen('w3blacklist', 'site', strings)