Update localization

This commit is contained in:
Griatch 2021-05-29 00:48:34 +02:00
parent 7ff8cbb341
commit 8837b93dd2
18 changed files with 1304 additions and 252 deletions

View file

@ -48,7 +48,11 @@ two-character international language codes are found
as clean and easy- to-read as possible. as clean and easy- to-read as possible.
``` ```
If you cannot find your language in `evennia/locale/` it's because noone has Translations are found in the core `evennia/` library, under
`evennia/evennia/locale/`. You must make sure to have cloned this repository
from [Evennia's github](github:evennia) before you can proceed.
If you cannot find your language in `evennia/evennia/locale/` it's because noone has
translated it yet. Alternatively you might have the language but find the translated it yet. Alternatively you might have the language but find the
translation bad ... You are welcome to help improve the situation! translation bad ... You are welcome to help improve the situation!
@ -56,8 +60,9 @@ To start a new translation you need to first have cloned the Evennia repositry
with GIT and activated a python virtualenv as described on the [Setup with GIT and activated a python virtualenv as described on the [Setup
Quickstart](../Setup/Setup-Quickstart) page. Quickstart](../Setup/Setup-Quickstart) page.
Go to your game dir and make sure your `virtualenv` is active so the `evennia` Go to `evennia/evennia/` - that is, not your game dir, but inside the `evennia/`
command is available. Then run repo itself. If you see the `locale/` folder you are in the right place. Make
sure your `virtualenv` is active so the `evennia` command is available. Then run
evennia makemessages --locale <language-code> evennia makemessages --locale <language-code>

View file

@ -104,7 +104,7 @@ SyntaxError encountered when loading cmdset '{path}'.
_ERROR_CMDSET_EXCEPTION = _( _ERROR_CMDSET_EXCEPTION = _(
"""{traceback} """{traceback}
Compile/Run error when loading cmdset '{path}'.", Compile/Run error when loading cmdset '{path}'.
(Traceback was logged {timestamp})""" (Traceback was logged {timestamp})"""
) )

View file

@ -4,7 +4,7 @@ will be treated as non-command help entries and displayed in the same way as
help entries created using the `sethelp` default command. After changing an help entries created using the `sethelp` default command. After changing an
entry on-disk you need to reload the server to have the change show in-game. entry on-disk you need to reload the server to have the change show in-game.
An filehelp file is a regular python modules with dicts representing each help An filehelp file is a regular python module with dicts representing each help
entry. If a list `HELP_ENTRY_DICTS` is found in the module, this should be a list of entry. If a list `HELP_ENTRY_DICTS` is found in the module, this should be a list of
dicts. Otherwise *all* top-level dicts in the module will be assumed to be a dicts. Otherwise *all* top-level dicts in the module will be assumed to be a
help-entry dict. help-entry dict.
@ -15,23 +15,23 @@ Each help-entry dict is on the form
{'key': <str>, {'key': <str>,
'category': <str>, # optional, otherwise settings.DEFAULT_HELP_CATEGORY 'category': <str>, # optional, otherwise settings.DEFAULT_HELP_CATEGORY
'aliases': <list>, # optional 'aliases': <list>, # optional
'text': <str>}`` 'text': <str>}
where the ``category`` is optional and the ``text`` should be formatted on the where the `category` is optional and the `text`` should be formatted on the
same form as other help entry-texts and contain ``# subtopics`` as normal. same form as other help entry-texts and contain ``# subtopics`` as normal.
New help-entry modules are added to the system by providing the python-path to New help-entry modules are added to the system by providing the python-path to
the module to `settings.FILE_HELP_ENTRY_MODULES`. Note that if same-key entries are the module to `settings.FILE_HELP_ENTRY_MODULES`. Note that if same-key entries are
added, entries in latter modules will override that of earlier ones. Use added, entries in latter modules will override that of earlier ones. Use
``settings.DEFAULT_HELP_CATEGORY`` to customize what category is used if `settings.DEFAULT_HELP_CATEGORY`` to customize what category is used if
not set explicitly. not set explicitly.
An example of the contents of a module: An example of the contents of a module:
:: ::
help_entry1 = { help_entry1 = {
"key": "The Gods", # case-insensitive, can be searched by 'gods' as well "key": "The Gods", # case-insensitive, also partial-matching ('gods') works
"aliases": ['pantheon', 'religion'] "aliases": ['pantheon', 'religion'],
"category": "Lore", "category": "Lore",
"text": ''' "text": '''
The gods formed the world ... The gods formed the world ...

View file

@ -1,6 +1,6 @@
# SOME DESCRIPTIVE TITLE. # Latin translator
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # Copyright (C) Evennia
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the Evennia package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# #
msgid "" msgid ""

View file

@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2019-09-21 05:00+0900\n" "PO-Revision-Date: 2019-09-21 05:00+0900\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: korean\n" "Language: ko\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"

View file

@ -9,10 +9,10 @@ msgstr ""
"Project-Id-Version: 0.1\n" "Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-04 21:25-0600\n" "POT-Creation-Date: 2021-02-04 21:25-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: 2021-02-04 21:25-0600\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: \n"
"Language: \n" "Language: la\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"

View file

@ -1,6 +1,6 @@
# Polish localization for the EVENNIA. # Polish localization for the EVENNIA.
# Copyright (C) 2019 # Copyright (C) 2019
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the Evennia package.
# FIRST AUTHOR <akroczyk@gmail.com>, 2019. # FIRST AUTHOR <akroczyk@gmail.com>, 2019.
# #
msgid "" msgid ""

File diff suppressed because it is too large Load diff

View file

@ -235,7 +235,8 @@ class LockHandler:
funcname, rest = (part.strip().strip(")") for part in funcstring.split("(", 1)) funcname, rest = (part.strip().strip(")") for part in funcstring.split("(", 1))
func = _LOCKFUNCS.get(funcname, None) func = _LOCKFUNCS.get(funcname, None)
if not callable(func): if not callable(func):
elist.append(_("Lock: lock-function '%s' is not available.") % funcstring) elist.append(_("Lock: lock-function '{lockfunc}' is not available.").format(
lockfunc=funcstring))
continue continue
args = list(arg.strip() for arg in rest.split(",") if arg and "=" not in arg) args = list(arg.strip() for arg in rest.split(",") if arg and "=" not in arg)
kwargs = dict( kwargs = dict(

View file

@ -54,6 +54,8 @@ _PROTOTYPE_RESERVED_KEYS = _PROTOTYPE_META_NAMES + (
"tags", "tags",
"attrs", "attrs",
) )
_ERRSTR = _("Error")
_WARNSTR = _("Warning")
PROTOTYPE_TAG_CATEGORY = "from_prototype" PROTOTYPE_TAG_CATEGORY = "from_prototype"
_PROTOTYPE_TAG_META_CATEGORY = "db_prototype" _PROTOTYPE_TAG_META_CATEGORY = "db_prototype"
@ -341,14 +343,16 @@ def delete_prototype(prototype_key, caller=None):
stored_prototype = DbPrototype.objects.filter(db_key__iexact=prototype_key) stored_prototype = DbPrototype.objects.filter(db_key__iexact=prototype_key)
if not stored_prototype: if not stored_prototype:
raise PermissionError(_("Prototype {} was not found.").format(prototype_key)) raise PermissionError(_("Prototype {prototype_key} was not found.").format(
prototype_key=prototype_key))
stored_prototype = stored_prototype[0] stored_prototype = stored_prototype[0]
if caller: if caller:
if not stored_prototype.access(caller, "edit"): if not stored_prototype.access(caller, "edit"):
raise PermissionError( raise PermissionError(
_("{} needs explicit 'edit' permissions to " _("{caller} needs explicit 'edit' permissions to "
"delete prototype {}.").format(caller, prototype_key) "delete prototype {prototype_key}.").format(
caller=caller, prototype_key=prototype_key)
) )
stored_prototype.delete() stored_prototype.delete()
return True return True
@ -659,7 +663,7 @@ def validate_prototype(
protkey = protkey and protkey.lower() or prototype.get("prototype_key", None) protkey = protkey and protkey.lower() or prototype.get("prototype_key", None)
if strict and not bool(protkey): if strict and not bool(protkey):
_flags["errors"].append(_("Prototype lacks a `prototype_key`.")) _flags["errors"].append(_("Prototype lacks a 'prototype_key'."))
protkey = "[UNSET]" protkey = "[UNSET]"
typeclass = prototype.get("typeclass") typeclass = prototype.get("typeclass")
@ -674,7 +678,7 @@ def validate_prototype(
else: else:
_flags["warnings"].append( _flags["warnings"].append(
_("Prototype {protkey} can only be used as a mixin since it lacks " _("Prototype {protkey} can only be used as a mixin since it lacks "
"a typeclass or a prototype_parent.").format(protkey=protkey) "'typeclass' or 'prototype_parent' keys.").format(protkey=protkey)
) )
if strict and typeclass: if strict and typeclass:
@ -707,7 +711,7 @@ def validate_prototype(
) )
if _flags["errors"]: if _flags["errors"]:
raise RuntimeError(_("Error: ") + _("\nError: ").join(_flags["errors"])) raise RuntimeError(f"{_ERRSTR}: " + f"\n{_ERRSTR}: ".join(_flags["errors"]))
_flags["visited"].append(id(prototype)) _flags["visited"].append(id(prototype))
_flags["depth"] += 1 _flags["depth"] += 1
validate_prototype( validate_prototype(
@ -729,9 +733,9 @@ def validate_prototype(
if _flags["depth"] <= 0: if _flags["depth"] <= 0:
if _flags["errors"]: if _flags["errors"]:
raise RuntimeError(_("Error: " + "\nError: ").join(_flags["errors"])) raise RuntimeError(f"{_ERRSTR}:_" + f"\n{_ERRSTR}: ".join(_flags["errors"]))
if _flags["warnings"]: if _flags["warnings"]:
raise RuntimeWarning(_("Warning: " + "\nWarning: ").join(_flags["warnings"])) raise RuntimeWarning(f"{_WARNSTR}: " + f"\n{_WARNSTR}: ".join(_flags["warnings"]))
# make sure prototype_locks are set to defaults # make sure prototype_locks are set to defaults
prototype_locks = [ prototype_locks = [

View file

@ -471,7 +471,7 @@ def flatten_diff(diff):
else: else:
raise RuntimeError( raise RuntimeError(
_("Diff contains non-dicts that are not on the " _("Diff contains non-dicts that are not on the "
"form (old, new, inst): {diffpart}").format(diffpart) "form (old, new, action_to_take): {diffpart}").format(diffpart)
) )
return out return out

View file

@ -326,8 +326,8 @@ class ScriptBase(ScriptDB, metaclass=TypeclassBase):
""" """
cname = self.__class__.__name__ cname = self.__class__.__name__
estring = _( estring = _(
"Script %(key)s(#%(dbid)s) of type '%(cname)s': at_repeat() error '%(err)s'." "Script {key}(#{dbid}) of type '{name}': at_repeat() error '{err}'.".format(
) % {"key": self.key, "dbid": self.dbid, "cname": cname, "err": e.getErrorMessage()} key=self.key, dbid=self.dbid, name=cname, err=e.getErrorMessage()))
try: try:
self.db_obj.msg(estring) self.db_obj.msg(estring)
except Exception: except Exception:

View file

@ -25,13 +25,11 @@ ERROR_NO_SUPERUSER = """
""" """
LIMBO_DESC = _( LIMBO_DESC = _("""
""" Welcome to your new |wEvennia|n-based game! Visit https://www.evennia.com if you need
Welcome to your new |wEvennia|n-based game! Visit http://www.evennia.com if you need
help, want to contribute, report issues or just join the community. help, want to contribute, report issues or just join the community.
As Account #1 you can create a demo/tutorial area with '|wbatchcommand tutorial_world.build|n'. As Account #1 you can create a demo/tutorial area with '|wbatchcommand tutorial_world.build|n'.
""" """)
)
WARNING_POSTGRESQL_FIX = """ WARNING_POSTGRESQL_FIX = """
@ -40,7 +38,7 @@ WARNING_POSTGRESQL_FIX = """
but the superuser was not yet connected to them. Please use in but the superuser was not yet connected to them. Please use in
game commands to connect Account #1 to those channels when first game commands to connect Account #1 to those channels when first
logging in. logging in.
""" """
def get_god_account(): def get_god_account():

View file

@ -85,6 +85,6 @@ class EvenniaPasswordValidator:
""" """
return _( return _(
"%s From a terminal client, you can also use a phrase of multiple words if " "{policy} From a terminal client, you can also use a phrase of multiple words if "
"you enclose the password in double quotes." % self.policy "you enclose the password in double quotes.".format(policy=self.policy)
) )

View file

@ -512,7 +512,7 @@ class CmdEditorGroup(CmdEditorBase):
# :dd <l> - delete line <l> # :dd <l> - delete line <l>
buf = linebuffer[:lstart] + linebuffer[lend:] buf = linebuffer[:lstart] + linebuffer[lend:]
editor.update_buffer(buf) editor.update_buffer(buf)
caller.msg(_("Deleted {string}.").format(string= self.lstr)) caller.msg(_("Deleted {string}.").format(string=self.lstr))
elif cmd == ":dw": elif cmd == ":dw":
# :dw <w> - delete word in entire buffer # :dw <w> - delete word in entire buffer
# :dw <l> <w> delete word only on line(s) <l> # :dw <l> <w> delete word only on line(s) <l>
@ -522,9 +522,11 @@ class CmdEditorGroup(CmdEditorBase):
if not self.linerange: if not self.linerange:
lstart = 0 lstart = 0
lend = self.cline + 1 lend = self.cline + 1
caller.msg(_("Removed %s for lines %i-%i.") % (self.arg1, lstart + 1, lend + 1)) caller.msg(_("Removed {arg1} for lines {l1}-{l2}.").format(
arg1=self.arg1, l1=lstart + 1, l2=lend + 1))
else: else:
caller.msg(_("Removed %s for %s.") % (self.arg1, self.lstr)) caller.msg(_("Removed {arg1} for {line}.").format(
arg1=self.arg1, line=self.lstr))
sarea = "\n".join(linebuffer[lstart:lend]) sarea = "\n".join(linebuffer[lstart:lend])
sarea = re.sub(r"%s" % self.arg1.strip("'").strip('"'), "", sarea, re.MULTILINE) sarea = re.sub(r"%s" % self.arg1.strip("'").strip('"'), "", sarea, re.MULTILINE)
buf = linebuffer[:lstart] + sarea.split("\n") + linebuffer[lend:] buf = linebuffer[:lstart] + sarea.split("\n") + linebuffer[lend:]
@ -539,19 +541,19 @@ class CmdEditorGroup(CmdEditorBase):
editor._indent = 0 editor._indent = 0
if editor._persistent: if editor._persistent:
caller.attributes.add("_eveditor_indent", 0) caller.attributes.add("_eveditor_indent", 0)
caller.msg(_("Cleared %i lines from buffer.") % self.nlines) caller.msg(_("Cleared {nlines} lines from buffer.").format(nlines=self.nlines))
elif cmd == ":y": elif cmd == ":y":
# :y <l> - yank line(s) to copy buffer # :y <l> - yank line(s) to copy buffer
cbuf = linebuffer[lstart:lend] cbuf = linebuffer[lstart:lend]
editor._copy_buffer = cbuf editor._copy_buffer = cbuf
caller.msg(_("%s, %s yanked.") % (self.lstr.capitalize(), cbuf)) caller.msg(_("{line}, {cbuf} yanked.").format(line=self.lstr.capitalize(), cbuf=cbuf))
elif cmd == ":x": elif cmd == ":x":
# :x <l> - cut line to copy buffer # :x <l> - cut line to copy buffer
cbuf = linebuffer[lstart:lend] cbuf = linebuffer[lstart:lend]
editor._copy_buffer = cbuf editor._copy_buffer = cbuf
buf = linebuffer[:lstart] + linebuffer[lend:] buf = linebuffer[:lstart] + linebuffer[lend:]
editor.update_buffer(buf) editor.update_buffer(buf)
caller.msg(_("%s, %s cut.") % (self.lstr.capitalize(), cbuf)) caller.msg(_("{line}, {cbuf} cut.").format(line=self.lstr.capitalize(), cbuf=cbuf))
elif cmd == ":p": elif cmd == ":p":
# :p <l> paste line(s) from copy buffer # :p <l> paste line(s) from copy buffer
if not editor._copy_buffer: if not editor._copy_buffer:
@ -559,7 +561,8 @@ class CmdEditorGroup(CmdEditorBase):
else: else:
buf = linebuffer[:lstart] + editor._copy_buffer + linebuffer[lstart:] buf = linebuffer[:lstart] + editor._copy_buffer + linebuffer[lstart:]
editor.update_buffer(buf) editor.update_buffer(buf)
caller.msg(_("Pasted buffer %s to %s.") % (editor._copy_buffer, self.lstr)) caller.msg(_("Pasted buffer {cbuf} to {line}.").format(
buf=editor._copy_buffer, line=self.lstr))
elif cmd == ":i": elif cmd == ":i":
# :i <l> <txt> - insert new line # :i <l> <txt> - insert new line
new_lines = self.args.split("\n") new_lines = self.args.split("\n")
@ -568,7 +571,8 @@ class CmdEditorGroup(CmdEditorBase):
else: else:
buf = linebuffer[:lstart] + new_lines + linebuffer[lstart:] buf = linebuffer[:lstart] + new_lines + linebuffer[lstart:]
editor.update_buffer(buf) editor.update_buffer(buf)
caller.msg(_("Inserted %i new line(s) at %s.") % (len(new_lines), self.lstr)) caller.msg(_("Inserted {num} new line(s) at {line}.").format(
num=len(new_lines), line=self.lstr))
elif cmd == ":r": elif cmd == ":r":
# :r <l> <txt> - replace lines # :r <l> <txt> - replace lines
new_lines = self.args.split("\n") new_lines = self.args.split("\n")
@ -577,7 +581,8 @@ class CmdEditorGroup(CmdEditorBase):
else: else:
buf = linebuffer[:lstart] + new_lines + linebuffer[lend:] buf = linebuffer[:lstart] + new_lines + linebuffer[lend:]
editor.update_buffer(buf) editor.update_buffer(buf)
caller.msg(_("Replaced %i line(s) at %s.") % (len(new_lines), self.lstr)) caller.msg(_("Replaced {num} line(s) at {line}.").format(
num=len(new_lines), line=self.lstr))
elif cmd == ":I": elif cmd == ":I":
# :I <l> <txt> - insert text at beginning of line(s) <l> # :I <l> <txt> - insert text at beginning of line(s) <l>
if not self.raw_string and not editor._codefunc: if not self.raw_string and not editor._codefunc:
@ -589,7 +594,7 @@ class CmdEditorGroup(CmdEditorBase):
+ linebuffer[lend:] + linebuffer[lend:]
) )
editor.update_buffer(buf) editor.update_buffer(buf)
caller.msg(_("Inserted text at beginning of %s.") % self.lstr) caller.msg(_("Inserted text at beginning of {line}.").format(line=self.lstr))
elif cmd == ":A": elif cmd == ":A":
# :A <l> <txt> - append text after end of line(s) # :A <l> <txt> - append text after end of line(s)
if not self.args: if not self.args:
@ -601,7 +606,7 @@ class CmdEditorGroup(CmdEditorBase):
+ linebuffer[lend:] + linebuffer[lend:]
) )
editor.update_buffer(buf) editor.update_buffer(buf)
caller.msg(_("Appended text to end of %s.") % self.lstr) caller.msg(_("Appended text to end of {line}.").format(line=self.lstr))
elif cmd == ":s": elif cmd == ":s":
# :s <li> <w> <txt> - search and replace words # :s <li> <w> <txt> - search and replace words
# in entire buffer or on certain lines # in entire buffer or on certain lines
@ -612,12 +617,13 @@ class CmdEditorGroup(CmdEditorBase):
lstart = 0 lstart = 0
lend = self.cline + 1 lend = self.cline + 1
caller.msg( caller.msg(
_("Search-replaced %s -> %s for lines %i-%i.") _("Search-replaced {arg1} -> {arg2} for lines {l1}-{l2}.").format(
% (self.arg1, self.arg2, lstart + 1, lend) arg1=self.arg1, arg2=self.arg2, l1=lstart + 1, l2=lend)
) )
else: else:
caller.msg( caller.msg(
_("Search-replaced %s -> %s for %s.") % (self.arg1, self.arg2, self.lstr) _("Search-replaced {arg1} -> {arg2} for {line}.").format(
arg1=self.arg1, arg2=self.arg2, line=self.lstr)
) )
sarea = "\n".join(linebuffer[lstart:lend]) sarea = "\n".join(linebuffer[lstart:lend])
@ -639,9 +645,10 @@ class CmdEditorGroup(CmdEditorBase):
if not self.linerange: if not self.linerange:
lstart = 0 lstart = 0
lend = self.cline + 1 lend = self.cline + 1
caller.msg(_("Flood filled lines %i-%i.") % (lstart + 1, lend)) caller.msg(_("Flood filled lines {l1}-{l2}.").format(
l1=lstart + 1, l2=lend))
else: else:
caller.msg(_("Flood filled %s.") % self.lstr) caller.msg(_("Flood filled {line}.").format(line=self.lstr))
fbuf = "\n".join(linebuffer[lstart:lend]) fbuf = "\n".join(linebuffer[lstart:lend])
fbuf = fill(fbuf, width=width) fbuf = fill(fbuf, width=width)
buf = linebuffer[:lstart] + fbuf.split("\n") + linebuffer[lend:] buf = linebuffer[:lstart] + fbuf.split("\n") + linebuffer[lend:]
@ -671,9 +678,11 @@ class CmdEditorGroup(CmdEditorBase):
if not self.linerange: if not self.linerange:
lstart = 0 lstart = 0
lend = self.cline + 1 lend = self.cline + 1
self.caller.msg(_("%s-justified lines %i-%i.") % (align_name[align], lstart + 1, lend)) self.caller.msg(_("{align}-justified lines {l1}-{l2}.").format(
align=align_name[align], l1=lstart + 1, l2=lend))
else: else:
self.caller.msg(_("%s-justified %s.") % (align_name[align], self.lstr)) self.caller.msg(_("{align}-justified {line}.").format(
align=align_name[align], line=self.lstr))
jbuf = "\n".join(linebuffer[lstart:lend]) jbuf = "\n".join(linebuffer[lstart:lend])
jbuf = justify(jbuf, width=width, align=align) jbuf = justify(jbuf, width=width, align=align)
buf = linebuffer[:lstart] + jbuf.split("\n") + linebuffer[lend:] buf = linebuffer[:lstart] + jbuf.split("\n") + linebuffer[lend:]
@ -684,9 +693,9 @@ class CmdEditorGroup(CmdEditorBase):
if not self.linerange: if not self.linerange:
lstart = 0 lstart = 0
lend = self.cline + 1 lend = self.cline + 1
caller.msg(_("Indented lines %i-%i.") % (lstart + 1, lend)) caller.msg(_("Indented lines {l1}-{l2}.").format(l1=lstart + 1, l2=lend))
else: else:
caller.msg(_("Indented %s.") % self.lstr) caller.msg(_("Indented {line}.").format(line=self.lstr))
fbuf = [indent + line for line in linebuffer[lstart:lend]] fbuf = [indent + line for line in linebuffer[lstart:lend]]
buf = linebuffer[:lstart] + fbuf + linebuffer[lend:] buf = linebuffer[:lstart] + fbuf + linebuffer[lend:]
editor.update_buffer(buf) editor.update_buffer(buf)
@ -695,9 +704,10 @@ class CmdEditorGroup(CmdEditorBase):
if not self.linerange: if not self.linerange:
lstart = 0 lstart = 0
lend = self.cline + 1 lend = self.cline + 1
caller.msg(_("Removed left margin (dedented) lines %i-%i.") % (lstart + 1, lend)) caller.msg(_("Removed left margin (dedented) lines {l1}-{l2}.").format(
l1=lstart + 1, l2=lend))
else: else:
caller.msg(_("Removed left margin (dedented) %s.") % self.lstr) caller.msg(_("Removed left margin (dedented) {line}.").format(line=self.lstr))
fbuf = "\n".join(linebuffer[lstart:lend]) fbuf = "\n".join(linebuffer[lstart:lend])
fbuf = dedent(fbuf) fbuf = dedent(fbuf)
buf = linebuffer[:lstart] + fbuf.split("\n") + linebuffer[lend:] buf = linebuffer[:lstart] + fbuf.split("\n") + linebuffer[lend:]
@ -705,7 +715,7 @@ class CmdEditorGroup(CmdEditorBase):
elif cmd == ":echo": elif cmd == ":echo":
# set echoing on/off # set echoing on/off
editor._echo_mode = not editor._echo_mode editor._echo_mode = not editor._echo_mode
caller.msg(_("Echo mode set to %s") % editor._echo_mode) caller.msg(_("Echo mode set to {mode}").format(mode=editor._echo_mode))
elif cmd == ":!": elif cmd == ":!":
if editor._codefunc: if editor._codefunc:
editor._codefunc(caller, editor._buffer) editor._codefunc(caller, editor._buffer)
@ -717,7 +727,9 @@ class CmdEditorGroup(CmdEditorBase):
editor.decrease_indent() editor.decrease_indent()
indent = editor._indent indent = editor._indent
if indent >= 0: if indent >= 0:
caller.msg(_("Decreased indentation: new indentation is {}.").format(indent)) caller.msg(_(
"Decreased indentation: new indentation is {indent}.").format(
indent=indent))
else: else:
caller.msg(_("|rManual indentation is OFF.|n Use := to turn it on.")) caller.msg(_("|rManual indentation is OFF.|n Use := to turn it on."))
else: else:
@ -728,7 +740,9 @@ class CmdEditorGroup(CmdEditorBase):
editor.increase_indent() editor.increase_indent()
indent = editor._indent indent = editor._indent
if indent >= 0: if indent >= 0:
caller.msg(_("Increased indentation: new indentation is {}.").format(indent)) caller.msg(_(
"Increased indentation: new indentation is {indent}.").format(
indent=indent))
else: else:
caller.msg(_("|rManual indentation is OFF.|n Use := to turn it on.")) caller.msg(_("|rManual indentation is OFF.|n Use := to turn it on."))
else: else:
@ -764,7 +778,7 @@ class EvEditorCmdSet(CmdSet):
# ------------------------------------------------------------- # -------------------------------------------------------------
class EvEditor(object): class EvEditor:
""" """
This defines a line editor object. It creates all relevant commands This defines a line editor object. It creates all relevant commands
and tracks the current state of the buffer. It also cleans up after and tracks the current state of the buffer. It also cleans up after
@ -1033,7 +1047,7 @@ class EvEditor(object):
header = ( header = (
"|n" "|n"
+ sep * 10 + sep * 10
+ _("Line Editor [%s]") % self._key + _("Line Editor [{name}]") % self._key
+ sep * (_DEFAULT_WIDTH - 24 - len(self._key)) + sep * (_DEFAULT_WIDTH - 24 - len(self._key))
) )
footer = ( footer = (

View file

@ -1333,10 +1333,31 @@ def list_node(option_generator, select=None, pagesize=10):
Example: Example:
```python ```python
list_node(['foo', 'bar'], select) def select(caller, selection, available_choices=None, **kwargs):
'''
Args:
caller (Object or Account): User of the menu.
selection (str): What caller chose in the menu
available_choices (list): The keys of elements available on the *current listing
page*.
**kwargs: Kwargs passed on from the node.
Returns:
tuple, str or None: A tuple (nextnodename, **kwargs) or just nextnodename. Return
`None` to go back to the listnode.
# (do something with `selection` here)
return "nextnode", **kwargs
@list_node(['foo', 'bar'], select)
def node_index(caller): def node_index(caller):
text = "describing the list" text = "describing the list"
return text, []
# optional extra options in addition to the list-options
extra_options = []
return text, extra_options
``` ```
Notes: Notes:
@ -1364,9 +1385,10 @@ def list_node(option_generator, select=None, pagesize=10):
if callable(select): if callable(select):
try: try:
if bool(getargspec(select).keywords): if bool(getargspec(select).keywords):
return select(caller, selection, available_choices=available_choices) return select(
caller, selection, available_choices=available_choices, **kwargs)
else: else:
return select(caller, selection) return select(caller, selection, **kwargs)
except Exception: except Exception:
logger.log_trace() logger.log_trace()
elif select: elif select:
@ -1405,7 +1427,7 @@ def list_node(option_generator, select=None, pagesize=10):
# callback being called with a result from the available choices # callback being called with a result from the available choices
options.extend( options.extend(
[ [
{"desc": opt, "goto": (_select_parser, {"available_choices": page})} {"desc": opt, "goto": (_select_parser, {"available_choices": page, **kwargs})}
for opt in page for opt in page
] ]
) )

View file

@ -2216,7 +2216,7 @@ def at_search_result(matches, caller, query="", quiet=False, **kwargs):
error = "" error = ""
if not matches: if not matches:
# no results. # no results.
error = kwargs.get("nofound_string") or _("Could not find '%s'." % query) error = kwargs.get("nofound_string") or _("Could not find '{query}'.").format(query=query)
matches = None matches = None
elif len(matches) > 1: elif len(matches) > 1:
multimatch_string = kwargs.get("multimatch_string") multimatch_string = kwargs.get("multimatch_string")
@ -2241,7 +2241,7 @@ def at_search_result(matches, caller, query="", quiet=False, **kwargs):
name=result.get_display_name(caller) name=result.get_display_name(caller)
if hasattr(result, "get_display_name") if hasattr(result, "get_display_name")
else query, else query,
aliases=" [%s]" % ";".join(aliases) if aliases else "", aliases=" [{alias}]".format(alias=";".join(aliases) if aliases else ""),
info=result.get_extra_info(caller), info=result.get_extra_info(caller),
) )
matches = None matches = None

View file

@ -5,7 +5,7 @@
{% for app in app_list %} {% for app in app_list %}
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path %} current-app{% endif %}"> <div class="app-{{ app.app_label }} module{% if app.app_url in request.path %} current-app{% endif %}">
<!--caption> <!--caption>
<a href="{{ app.app_url }}" class="section" title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">{{ app.name }}</a> <a href="{{ app.app_url }}" class="section" title="Models in the {{ name }} application">{{ app.name }}</a>
</caption--> </caption-->
{% for model in app.models %} {% for model in app.models %}
<tr class="model-{{ model.object_name|lower }}{% if model.admin_url in request.path %} current-model{% endif %}"> <tr class="model-{{ model.object_name|lower }}{% if model.admin_url in request.path %} current-model{% endif %}">