Returns a comma-separated list for the given list of parts. The format is, e.g., "A, B and C", "A and B" or just "A" for lists of size 1.
(self, parts: Any)
| 448 | } |
| 449 | |
| 450 | def list(self, parts: Any) -> str: |
| 451 | """Returns a comma-separated list for the given list of parts. |
| 452 | |
| 453 | The format is, e.g., "A, B and C", "A and B" or just "A" for lists |
| 454 | of size 1. |
| 455 | """ |
| 456 | _ = self.translate |
| 457 | if len(parts) == 0: |
| 458 | return "" |
| 459 | if len(parts) == 1: |
| 460 | return parts[0] |
| 461 | comma = u" \u0648 " if self.code.startswith("fa") else u", " |
| 462 | return _("%(commas)s and %(last)s") % { |
| 463 | "commas": comma.join(parts[:-1]), |
| 464 | "last": parts[len(parts) - 1], |
| 465 | } |
| 466 | |
| 467 | def friendly_number(self, value: int) -> str: |
| 468 | """Returns a comma-separated number for the given integer.""" |