mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Update localization
This commit is contained in:
parent
7ff8cbb341
commit
8837b93dd2
18 changed files with 1304 additions and 252 deletions
|
|
@ -48,7 +48,11 @@ two-character international language codes are found
|
|||
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
|
||||
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
|
||||
Quickstart](../Setup/Setup-Quickstart) page.
|
||||
|
||||
Go to your game dir and make sure your `virtualenv` is active so the `evennia`
|
||||
command is available. Then run
|
||||
Go to `evennia/evennia/` - that is, not your game dir, but inside the `evennia/`
|
||||
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>
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ SyntaxError encountered when loading cmdset '{path}'.
|
|||
|
||||
_ERROR_CMDSET_EXCEPTION = _(
|
||||
"""{traceback}
|
||||
Compile/Run error when loading cmdset '{path}'.",
|
||||
Compile/Run error when loading cmdset '{path}'.
|
||||
(Traceback was logged {timestamp})"""
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
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
|
||||
dicts. Otherwise *all* top-level dicts in the module will be assumed to be a
|
||||
help-entry dict.
|
||||
|
|
@ -15,23 +15,23 @@ Each help-entry dict is on the form
|
|||
{'key': <str>,
|
||||
'category': <str>, # optional, otherwise settings.DEFAULT_HELP_CATEGORY
|
||||
'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.
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
An example of the contents of a module:
|
||||
::
|
||||
|
||||
help_entry1 = {
|
||||
"key": "The Gods", # case-insensitive, can be searched by 'gods' as well
|
||||
"aliases": ['pantheon', 'religion']
|
||||
"key": "The Gods", # case-insensitive, also partial-matching ('gods') works
|
||||
"aliases": ['pantheon', 'religion'],
|
||||
"category": "Lore",
|
||||
"text": '''
|
||||
The gods formed the world ...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# Latin translator
|
||||
# Copyright (C) Evennia
|
||||
# This file is distributed under the same license as the Evennia package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ msgstr ""
|
|||
"PO-Revision-Date: 2019-09-21 05:00+0900\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: korean\n"
|
||||
"Language: ko\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ msgstr ""
|
|||
"Project-Id-Version: 0.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-02-04 21:25-0600\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"PO-Revision-Date: 2021-02-04 21:25-0600\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: la\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Polish localization for the EVENNIA.
|
||||
# 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.
|
||||
#
|
||||
msgid ""
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -235,7 +235,8 @@ class LockHandler:
|
|||
funcname, rest = (part.strip().strip(")") for part in funcstring.split("(", 1))
|
||||
func = _LOCKFUNCS.get(funcname, None)
|
||||
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
|
||||
args = list(arg.strip() for arg in rest.split(",") if arg and "=" not in arg)
|
||||
kwargs = dict(
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ _PROTOTYPE_RESERVED_KEYS = _PROTOTYPE_META_NAMES + (
|
|||
"tags",
|
||||
"attrs",
|
||||
)
|
||||
_ERRSTR = _("Error")
|
||||
_WARNSTR = _("Warning")
|
||||
PROTOTYPE_TAG_CATEGORY = "from_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)
|
||||
|
||||
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]
|
||||
if caller:
|
||||
if not stored_prototype.access(caller, "edit"):
|
||||
raise PermissionError(
|
||||
_("{} needs explicit 'edit' permissions to "
|
||||
"delete prototype {}.").format(caller, prototype_key)
|
||||
_("{caller} needs explicit 'edit' permissions to "
|
||||
"delete prototype {prototype_key}.").format(
|
||||
caller=caller, prototype_key=prototype_key)
|
||||
)
|
||||
stored_prototype.delete()
|
||||
return True
|
||||
|
|
@ -659,7 +663,7 @@ def validate_prototype(
|
|||
protkey = protkey and protkey.lower() or prototype.get("prototype_key", None)
|
||||
|
||||
if strict and not bool(protkey):
|
||||
_flags["errors"].append(_("Prototype lacks a `prototype_key`."))
|
||||
_flags["errors"].append(_("Prototype lacks a 'prototype_key'."))
|
||||
protkey = "[UNSET]"
|
||||
|
||||
typeclass = prototype.get("typeclass")
|
||||
|
|
@ -674,7 +678,7 @@ def validate_prototype(
|
|||
else:
|
||||
_flags["warnings"].append(
|
||||
_("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:
|
||||
|
|
@ -707,7 +711,7 @@ def validate_prototype(
|
|||
)
|
||||
|
||||
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["depth"] += 1
|
||||
validate_prototype(
|
||||
|
|
@ -729,9 +733,9 @@ def validate_prototype(
|
|||
|
||||
if _flags["depth"] <= 0:
|
||||
if _flags["errors"]:
|
||||
raise RuntimeError(_("Error: " + "\nError: ").join(_flags["errors"]))
|
||||
raise RuntimeError(f"{_ERRSTR}:_" + f"\n{_ERRSTR}: ".join(_flags["errors"]))
|
||||
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
|
||||
prototype_locks = [
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ def flatten_diff(diff):
|
|||
else:
|
||||
raise RuntimeError(
|
||||
_("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
|
||||
|
||||
|
|
|
|||
|
|
@ -326,8 +326,8 @@ class ScriptBase(ScriptDB, metaclass=TypeclassBase):
|
|||
"""
|
||||
cname = self.__class__.__name__
|
||||
estring = _(
|
||||
"Script %(key)s(#%(dbid)s) of type '%(cname)s': at_repeat() error '%(err)s'."
|
||||
) % {"key": self.key, "dbid": self.dbid, "cname": cname, "err": e.getErrorMessage()}
|
||||
"Script {key}(#{dbid}) of type '{name}': at_repeat() error '{err}'.".format(
|
||||
key=self.key, dbid=self.dbid, name=cname, err=e.getErrorMessage()))
|
||||
try:
|
||||
self.db_obj.msg(estring)
|
||||
except Exception:
|
||||
|
|
|
|||
|
|
@ -25,13 +25,11 @@ ERROR_NO_SUPERUSER = """
|
|||
"""
|
||||
|
||||
|
||||
LIMBO_DESC = _(
|
||||
"""
|
||||
Welcome to your new |wEvennia|n-based game! Visit http://www.evennia.com if you need
|
||||
LIMBO_DESC = _("""
|
||||
Welcome to your new |wEvennia|n-based game! Visit https://www.evennia.com if you need
|
||||
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'.
|
||||
"""
|
||||
)
|
||||
""")
|
||||
|
||||
|
||||
WARNING_POSTGRESQL_FIX = """
|
||||
|
|
@ -40,7 +38,7 @@ WARNING_POSTGRESQL_FIX = """
|
|||
but the superuser was not yet connected to them. Please use in
|
||||
game commands to connect Account #1 to those channels when first
|
||||
logging in.
|
||||
"""
|
||||
"""
|
||||
|
||||
|
||||
def get_god_account():
|
||||
|
|
|
|||
|
|
@ -85,6 +85,6 @@ class EvenniaPasswordValidator:
|
|||
|
||||
"""
|
||||
return _(
|
||||
"%s From a terminal client, you can also use a phrase of multiple words if "
|
||||
"you enclose the password in double quotes." % self.policy
|
||||
"{policy} From a terminal client, you can also use a phrase of multiple words if "
|
||||
"you enclose the password in double quotes.".format(policy=self.policy)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -512,7 +512,7 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
# :dd <l> - delete line <l>
|
||||
buf = linebuffer[:lstart] + linebuffer[lend:]
|
||||
editor.update_buffer(buf)
|
||||
caller.msg(_("Deleted {string}.").format(string= self.lstr))
|
||||
caller.msg(_("Deleted {string}.").format(string=self.lstr))
|
||||
elif cmd == ":dw":
|
||||
# :dw <w> - delete word in entire buffer
|
||||
# :dw <l> <w> delete word only on line(s) <l>
|
||||
|
|
@ -522,9 +522,11 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
if not self.linerange:
|
||||
lstart = 0
|
||||
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:
|
||||
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 = re.sub(r"%s" % self.arg1.strip("'").strip('"'), "", sarea, re.MULTILINE)
|
||||
buf = linebuffer[:lstart] + sarea.split("\n") + linebuffer[lend:]
|
||||
|
|
@ -539,19 +541,19 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
editor._indent = 0
|
||||
if editor._persistent:
|
||||
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":
|
||||
# :y <l> - yank line(s) to copy buffer
|
||||
cbuf = linebuffer[lstart:lend]
|
||||
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":
|
||||
# :x <l> - cut line to copy buffer
|
||||
cbuf = linebuffer[lstart:lend]
|
||||
editor._copy_buffer = cbuf
|
||||
buf = linebuffer[:lstart] + linebuffer[lend:]
|
||||
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":
|
||||
# :p <l> paste line(s) from copy buffer
|
||||
if not editor._copy_buffer:
|
||||
|
|
@ -559,7 +561,8 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
else:
|
||||
buf = linebuffer[:lstart] + editor._copy_buffer + linebuffer[lstart:]
|
||||
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":
|
||||
# :i <l> <txt> - insert new line
|
||||
new_lines = self.args.split("\n")
|
||||
|
|
@ -568,7 +571,8 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
else:
|
||||
buf = linebuffer[:lstart] + new_lines + linebuffer[lstart:]
|
||||
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":
|
||||
# :r <l> <txt> - replace lines
|
||||
new_lines = self.args.split("\n")
|
||||
|
|
@ -577,7 +581,8 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
else:
|
||||
buf = linebuffer[:lstart] + new_lines + linebuffer[lend:]
|
||||
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":
|
||||
# :I <l> <txt> - insert text at beginning of line(s) <l>
|
||||
if not self.raw_string and not editor._codefunc:
|
||||
|
|
@ -589,7 +594,7 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
+ linebuffer[lend:]
|
||||
)
|
||||
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":
|
||||
# :A <l> <txt> - append text after end of line(s)
|
||||
if not self.args:
|
||||
|
|
@ -601,7 +606,7 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
+ linebuffer[lend:]
|
||||
)
|
||||
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":
|
||||
# :s <li> <w> <txt> - search and replace words
|
||||
# in entire buffer or on certain lines
|
||||
|
|
@ -612,12 +617,13 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
lstart = 0
|
||||
lend = self.cline + 1
|
||||
caller.msg(
|
||||
_("Search-replaced %s -> %s for lines %i-%i.")
|
||||
% (self.arg1, self.arg2, lstart + 1, lend)
|
||||
_("Search-replaced {arg1} -> {arg2} for lines {l1}-{l2}.").format(
|
||||
arg1=self.arg1, arg2=self.arg2, l1=lstart + 1, l2=lend)
|
||||
)
|
||||
else:
|
||||
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])
|
||||
|
||||
|
|
@ -639,9 +645,10 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
if not self.linerange:
|
||||
lstart = 0
|
||||
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:
|
||||
caller.msg(_("Flood filled %s.") % self.lstr)
|
||||
caller.msg(_("Flood filled {line}.").format(line=self.lstr))
|
||||
fbuf = "\n".join(linebuffer[lstart:lend])
|
||||
fbuf = fill(fbuf, width=width)
|
||||
buf = linebuffer[:lstart] + fbuf.split("\n") + linebuffer[lend:]
|
||||
|
|
@ -671,9 +678,11 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
if not self.linerange:
|
||||
lstart = 0
|
||||
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:
|
||||
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 = justify(jbuf, width=width, align=align)
|
||||
buf = linebuffer[:lstart] + jbuf.split("\n") + linebuffer[lend:]
|
||||
|
|
@ -684,9 +693,9 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
if not self.linerange:
|
||||
lstart = 0
|
||||
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:
|
||||
caller.msg(_("Indented %s.") % self.lstr)
|
||||
caller.msg(_("Indented {line}.").format(line=self.lstr))
|
||||
fbuf = [indent + line for line in linebuffer[lstart:lend]]
|
||||
buf = linebuffer[:lstart] + fbuf + linebuffer[lend:]
|
||||
editor.update_buffer(buf)
|
||||
|
|
@ -695,9 +704,10 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
if not self.linerange:
|
||||
lstart = 0
|
||||
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:
|
||||
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 = dedent(fbuf)
|
||||
buf = linebuffer[:lstart] + fbuf.split("\n") + linebuffer[lend:]
|
||||
|
|
@ -705,7 +715,7 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
elif cmd == ":echo":
|
||||
# set echoing on/off
|
||||
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 == ":!":
|
||||
if editor._codefunc:
|
||||
editor._codefunc(caller, editor._buffer)
|
||||
|
|
@ -717,7 +727,9 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
editor.decrease_indent()
|
||||
indent = editor._indent
|
||||
if indent >= 0:
|
||||
caller.msg(_("Decreased indentation: new indentation is {}.").format(indent))
|
||||
caller.msg(_(
|
||||
"Decreased indentation: new indentation is {indent}.").format(
|
||||
indent=indent))
|
||||
else:
|
||||
caller.msg(_("|rManual indentation is OFF.|n Use := to turn it on."))
|
||||
else:
|
||||
|
|
@ -728,7 +740,9 @@ class CmdEditorGroup(CmdEditorBase):
|
|||
editor.increase_indent()
|
||||
indent = editor._indent
|
||||
if indent >= 0:
|
||||
caller.msg(_("Increased indentation: new indentation is {}.").format(indent))
|
||||
caller.msg(_(
|
||||
"Increased indentation: new indentation is {indent}.").format(
|
||||
indent=indent))
|
||||
else:
|
||||
caller.msg(_("|rManual indentation is OFF.|n Use := to turn it on."))
|
||||
else:
|
||||
|
|
@ -764,7 +778,7 @@ class EvEditorCmdSet(CmdSet):
|
|||
# -------------------------------------------------------------
|
||||
|
||||
|
||||
class EvEditor(object):
|
||||
class EvEditor:
|
||||
"""
|
||||
This defines a line editor object. It creates all relevant commands
|
||||
and tracks the current state of the buffer. It also cleans up after
|
||||
|
|
@ -1033,7 +1047,7 @@ class EvEditor(object):
|
|||
header = (
|
||||
"|n"
|
||||
+ sep * 10
|
||||
+ _("Line Editor [%s]") % self._key
|
||||
+ _("Line Editor [{name}]") % self._key
|
||||
+ sep * (_DEFAULT_WIDTH - 24 - len(self._key))
|
||||
)
|
||||
footer = (
|
||||
|
|
|
|||
|
|
@ -1333,10 +1333,31 @@ def list_node(option_generator, select=None, pagesize=10):
|
|||
Example:
|
||||
|
||||
```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):
|
||||
text = "describing the list"
|
||||
return text, []
|
||||
|
||||
# optional extra options in addition to the list-options
|
||||
extra_options = []
|
||||
|
||||
return text, extra_options
|
||||
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
|
@ -1364,9 +1385,10 @@ def list_node(option_generator, select=None, pagesize=10):
|
|||
if callable(select):
|
||||
try:
|
||||
if bool(getargspec(select).keywords):
|
||||
return select(caller, selection, available_choices=available_choices)
|
||||
return select(
|
||||
caller, selection, available_choices=available_choices, **kwargs)
|
||||
else:
|
||||
return select(caller, selection)
|
||||
return select(caller, selection, **kwargs)
|
||||
except Exception:
|
||||
logger.log_trace()
|
||||
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
|
||||
options.extend(
|
||||
[
|
||||
{"desc": opt, "goto": (_select_parser, {"available_choices": page})}
|
||||
{"desc": opt, "goto": (_select_parser, {"available_choices": page, **kwargs})}
|
||||
for opt in page
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2216,7 +2216,7 @@ def at_search_result(matches, caller, query="", quiet=False, **kwargs):
|
|||
error = ""
|
||||
if not matches:
|
||||
# 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
|
||||
elif len(matches) > 1:
|
||||
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)
|
||||
if hasattr(result, "get_display_name")
|
||||
else query,
|
||||
aliases=" [%s]" % ";".join(aliases) if aliases else "",
|
||||
aliases=" [{alias}]".format(alias=";".join(aliases) if aliases else ""),
|
||||
info=result.get_extra_info(caller),
|
||||
)
|
||||
matches = None
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
{% for app in app_list %}
|
||||
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path %} current-app{% endif %}">
|
||||
<!--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-->
|
||||
{% for model in app.models %}
|
||||
<tr class="model-{{ model.object_name|lower }}{% if model.admin_url in request.path %} current-model{% endif %}">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue