Update to dgettext and fix translator-credits string

This commit is contained in:
skilpedde
2024-10-22 13:03:25 +02:00
parent ce584a09c2
commit 498f99e771
2 changed files with 7 additions and 14 deletions

View File

@@ -18,6 +18,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
import gettext
import logging
from time import time
from typing import Any, Optional
@@ -33,7 +34,6 @@ from cartridges.importer.source import Source
from cartridges.store.managers.async_manager import AsyncManager
from cartridges.store.pipeline import Pipeline
# pylint: disable=too-many-instance-attributes
class Importer(ErrorProducer):
"""A class in charge of scanning sources for games"""
@@ -376,20 +376,13 @@ class Importer(ErrorProducer):
"import",
)
elif self.n_games_added == 1:
toast_title = _("1 game imported")
elif self.n_games_added >= 1:
# The variable is the number of games imported
toast_title = gettext.ngettext("1 game imported", "{} games imported", self.n_games_added).format(self.n_games_added)
elif self.n_games_added > 1:
# The variable is the number of games
toast_title = _("{} games imported").format(self.n_games_added)
if (removed_length := len(self.removed_game_ids)) == 1:
# A single game removed
toast_title += ", " + _("1 removed")
elif removed_length > 1:
if (removed_length := len(self.removed_game_ids)) >= 1:
# The variable is the number of games removed
toast_title += ", " + _("{} removed").format(removed_length)
toast_title += ", " + gettext.ngettext("1 removed", "{} removed", removed_length).format(removed_length)
if self.n_games_added or self.removed_game_ids:
toast.set_button_label(_("Undo"))

View File

@@ -288,7 +288,7 @@ class CartridgesApplication(Adw.Application):
about.set_designers(("kramo https://kramo.page",))
about.set_copyright("© 2022-2024 kramo")
# Translators: Replace this with your name for it to show up in the about window
about.set_translator_credits = (_("translator_credits"),)
about.set_translator_credits = (_("translator-credits"),)
about.set_debug_info(debug_str)
about.set_debug_info_filename("cartridges.log")
about.add_legal_section(