Skip to content
Myr

Localisation of more strings (#2902)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Eric Platon · committed by GitHub · parent 73e1550 · Browse files · 9 files+54 added−32 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Carmen Bianca BAKKER <carmen@carmenbianca.eu>

Diff stats

9 files+54 added−32 removed

  • other:+54 added−32 removed

9 files+54 added−32 removed

modified:src/click/_termui_impl.py+7 added-1 removed
171 unmodified lines
172 t //= 60173 hours = t % 24174 t //= 24175 if t > 0:176 return f"{t}d {hours:02}:{minutes:02}:{seconds:02}"176 return "{d}{day_label} {h:02}:{m:02}:{s:02}".format(177 d=t,178 day_label=_("d"),179 h=hours,180 m=minutes,181 s=seconds,182 )183 else:184 return f"{hours:02}:{minutes:02}:{seconds:02}"185 return ""186
711 unmodified lines
modified:src/click/_winconsole.py+3 added-2 removed
26 unmodified lines
27from ctypes.wintypes import DWORD28from ctypes.wintypes import HANDLE29from ctypes.wintypes import LPCWSTR30from ctypes.wintypes import LPWSTR31from gettext import gettext as _3233from ._compat import _NonClosingTextIOWrapper3435assert sys.platform == "win32"
116 unmodified lines
152 if GetLastError() == ERROR_OPERATION_ABORTED:153 # wait for KeyboardInterrupt154 time.sleep(0.1)155 if not rv:155 raise OSError(f"Windows error: {GetLastError()}")156 raise OSError(_("Windows error: {error}").format(error=GetLastError()))157158 if buffer[0] == EOF:159 return 0160 return 2 * code_units_read.value
8 unmodified lines
169 if errno == ERROR_SUCCESS:170 return "ERROR_SUCCESS"171 elif errno == ERROR_NOT_ENOUGH_MEMORY:172 return "ERROR_NOT_ENOUGH_MEMORY"172 return f"Windows error {errno}"173 return _("Windows error: {error}").format(error=errno)174175 def write(self, b: Buffer) -> int:176 bytes_to_be_written = len(b)177 buf = get_buffer(b)
120 unmodified lines
modified:src/click/core.py+25 added-19 removed
1134 unmodified lines
1135 else:1136 text = ""11371138 if self.deprecated:1139 localised_deprectated = _("deprecated").upper()1140 deprecated_message = (1140 f"(DEPRECATED: {self.deprecated})"1141 f"({localised_deprectated}: {self.deprecated})"1142 if isinstance(self.deprecated, str)1142 else "(DEPRECATED)"1143 else f"({localised_deprectated})"1144 )1144 text = _("{text} {deprecated_message}").format(1145 text=text, deprecated_message=deprecated_message1146 )1145 text = f"{_(text)} {deprecated_message}"11461147 return text.strip()11481149 def format_help(self, ctx: Context, formatter: HelpFormatter) -> None:
21 unmodified lines
1171 else:1172 text = ""11731174 if self.deprecated:1175 localised_deprectated = _("deprecated").upper()1176 deprecated_message = (1177 f"(DEPRECATED: {self.deprecated})"1177 f"({localised_deprectated}: {self.deprecated})"1178 if isinstance(self.deprecated, str)1179 else "(DEPRECATED)"1179 else f"({localised_deprectated})"1180 )1181 text = _("{text} {deprecated_message}").format(1182 text=text, deprecated_message=deprecated_message1183 )1181 text = f"{_(text)} {deprecated_message}"11821183 if text:1184 formatter.write_paragraph()1185
1795 unmodified lines
29812982 for decl in decls:2983 if decl.isidentifier():2984 if name is not None:2987 raise TypeError(f"Name '{name}' defined twice")2985 raise TypeError(_("Name '{name}' defined twice").format(name=name))2986 name = decl2987 else:2988 split_char = ";" if decl[:1] == "/" else "/"2989 if split_char in decl:
6 unmodified lines
2996 if second:2997 secondary_opts.append(second.lstrip())2998 if first == second:2999 raise ValueError(3000 _(3002 f"Boolean option {decl!r} cannot use the"3003 " same flag for true/false."3001 "Boolean option {decl!r} cannot use the"3002 " same flag for true/false."3003 ).format(decl=decl)3004 )3005 else:3006 possible_names.append(_split_opt(decl))3007 opts.append(decl)
7 unmodified lines
3015 if name is None:3016 if not expose_value:3017 return "", opts, secondary_opts3018 raise TypeError(3019 _(3019 f"Could not determine name for option with declarations {decls!r}"3020 "Could not determine name for option with declarations {decls!r}"3021 ).format(decls=decls)3022 )30233024 if not opts and not secondary_opts:3025 raise TypeError(3026 _(3024 f"No options defined but a name was passed ({name})."3025 " Did you mean to declare an argument instead? Did"3026 f" you mean to pass '--{name}'?"3027 "No options defined but a name was passed ({name})."3028 " Did you mean to declare an argument instead? Did"3029 " you mean to pass '--{name}'?"3030 ).format(name=name)3031 )30323033 return name, opts, secondary_opts3034
423 unmodified lines
3458 name = arg = decls[0]3459 name = name.replace("-", "_").lower()3460 else:3461 raise TypeError(3462 _(3458 "Arguments take exactly one parameter declaration, got"3459 f" {len(decls)}: {decls}."3463 "Arguments take exactly one parameter declaration, got"3464 " {length}: {decls}."3465 ).format(length=len(decls), decls=decls)3466 )3467 return name, [arg], []34683469 def get_usage_pieces(self, ctx: Context) -> list[str]:
33 unmodified lines
modified:src/click/decorators.py+2 added-2 removed
394 unmodified lines
395396 kwargs.setdefault("is_flag", True)397 kwargs.setdefault("callback", callback)398 kwargs.setdefault("expose_value", False)399 kwargs.setdefault("prompt", "Do you want to continue?")400 kwargs.setdefault("help", "Confirm the action without prompting.")399 kwargs.setdefault("prompt", _("Do you want to continue?"))400 kwargs.setdefault("help", _("Confirm the action without prompting."))401 return option(*param_decls, **kwargs)402403404def password_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]:
147 unmodified lines
modified:src/click/formatting.py+1 added-1 removed
151 unmodified lines
152 :param prefix: The prefix for the first line. Defaults to153 ``"Usage: "``.154 """155 if prefix is None:156 prefix = f"{_('Usage:')} "156 prefix = "{usage} ".format(usage=_("Usage:"))157158 usage_prefix = f"{prefix:>{self.current_indent}}{prog} "159 text_width = self.width - self.current_indent160
141 unmodified lines
modified:src/click/parser.py+5 added-1 removed
139 unmodified lines
140141 for opt in opts:142 prefix, value = _split_opt(opt)143 if not prefix:144 raise ValueError(f"Invalid start character for option ({opt})")144 raise ValueError(145 _("Invalid start character for option ({option})").format(146 option=opt147 )148 )149 self.prefixes.add(prefix[0])150 if len(prefix) == 1 and len(value) == 1:151 self._short_opts.append(opt)152 else:
381 unmodified lines
modified:src/click/termui.py+2 added-2 removed
650 unmodified lines
651 if fg:652 try:653 bits.append(f"\033[{_interpret_color(fg)}m")654 except KeyError:655 raise TypeError(f"Unknown color {fg!r}") from None655 raise TypeError(_("Unknown color {colour!r}").format(colour=fg)) from None656657 if bg:658 try:659 bits.append(f"\033[{_interpret_color(bg, 10)}m")660 except KeyError:661 raise TypeError(f"Unknown color {bg!r}") from None661 raise TypeError(_("Unknown color {colour!r}").format(colour=bg)) from None662663 if bold is not None:664 bits.append(f"\033[{1 if bold else 22}m")665 if dim is not None:
256 unmodified lines
modified:src/click/types.py+6 added-2 removed
388 unmodified lines
389 len(self.choices),390 ).format(value=value, choice=choices_str, choices=choices_str)391392 def __repr__(self) -> str:393 return f"Choice({list(self.choices)})"393 return _("Choice({choices})").format(choices=list(self.choices))394395 def shell_complete(396 self, ctx: Context, param: Parameter, incomplete: str397 ) -> list[CompletionItem]:
489 unmodified lines
887 ctx.call_on_close(safecall(f.flush))888889 return f890 except OSError as e:891 self.fail(f"'{format_filename(value)}': {e.strerror}", param, ctx)891 self.fail(892 f"'{format_filename(value)}': {e.strerror}",893 param,894 ctx,895 )896897 def shell_complete(898 self, ctx: Context, param: Parameter, incomplete: str899 ) -> list[CompletionItem]:
397 unmodified lines
modified:src/click/utils.py+3 added-2 removed
4 unmodified lines
5import re6import sys7import typing as t8from functools import update_wrapper9from gettext import gettext as _10from types import ModuleType11from types import TracebackType1213from ._compat import _default_text_stderr
319 unmodified lines
333 ``'stdout'`` and ``'stderr'``334 """335 opener = binary_streams.get(name)336 if opener is None:336 raise TypeError(f"Unknown standard stream '{name}'")337 raise TypeError(_("Unknown standard stream '{name}'").format(name=name))338 return opener()339340341def get_text_stream(
12 unmodified lines
354 :param errors: overrides the default error mode.355 """356 opener = text_streams.get(name)357 if opener is None:357 raise TypeError(f"Unknown standard stream '{name}'")358 raise TypeError(_("Unknown standard stream '{name}'").format(name=name))359 return opener(encoding, errors)360361362def open_file(
269 unmodified lines