Пример #1
0
 def test_plural_context_forms1(self):
     eq = self.assertEqual
     x = gettext.npgettext('With context',
                           'There is %s file', 'There are %s files', 1)
     eq(x, 'Hay %s fichero (context)')
     x = gettext.npgettext('With context',
                           'There is %s file', 'There are %s files', 2)
     eq(x, 'Hay %s ficheros (context)')
 def test_plural_context_forms1(self):
     eq = self.assertEqual
     x = gettext.npgettext('With context', 'There is %s file',
                           'There are %s files', 1)
     eq(x, 'Hay %s fichero (context)')
     x = gettext.npgettext('With context', 'There is %s file',
                           'There are %s files', 2)
     eq(x, 'Hay %s ficheros (context)')
Пример #3
0
 def cleanup_docker_garbage(self, docker_type):
     plural_type = docker_type + "s"
     if docker_type == "image":
         context = "female"
     else:
         context = "male"
     print()
     print_info(
         _("Removing leftover docker {item}").format(item=plural_type),
         bold=False)
     objects = getattr(self, "get_docker_{}_list".format(plural_type))()
     if len(objects) == 0:
         if context == "female":
             message = gettext.pgettext(
                 "female", "no candidate {item}s found for removing")
         else:
             message = gettext.pgettext(
                 "male", "no candidate {item}s found for removing")
         print_info(message.format(item=docker_type),
                    symbol="==>",
                    color="green")
         return
     subprocess.run(
         self.sudo_wrapper(["docker", docker_type, "rm"] + objects))
     number = len(objects)
     if context == "female":
         message = gettext.npgettext("female",
                                     "finished: {n} {item} removed",
                                     "finished: {n} {items} removed",
                                     number)
     else:
         message = gettext.npgettext("male", "finished: {n} {item} removed",
                                     "finished: {n} {items} removed",
                                     number).format(n=number,
                                                    item=docker_type,
                                                    items=plural_type)
     print_info(message.format(n=number,
                               item=docker_type,
                               items=plural_type),
                symbol="==>",
                color="green")
Пример #4
0
 def list_docker_garbage(self, docker_type):
     plural_type = docker_type + "s"
     if docker_type == "image":
         context = "female"
     else:
         context = "male"
     # Count images
     number = len(getattr(self, "get_docker_{}_list".format(plural_type))())
     print()
     print_info(_("Docker {item}").format(item=plural_type), bold=False)
     if context == "female":
         message = gettext.npgettext("female", "{n} docker {item} found",
                                     "{n} docker {items} found", number)
     else:
         message = gettext.npgettext("male", "{n} docker {item} found",
                                     "{n} docker {items} found", number)
     print_info(message.format(n=number,
                               item=docker_type,
                               items=plural_type),
                symbol="==>",
                color="green")
Пример #5
0
 def update_event(self, inp=-1):
     self.set_output_val(
         0,
         gettext.npgettext(self.input(0), self.input(1), self.input(2),
                           self.input(3)))