I pulled the latest master branch and found there are several untranslated new strings in menus and dialog boxes. I have some questions on translation.
- Should Runner view be untranslated?
We decided that Coder and Builder should be untranslated when internationalization of user interface was started. It looks that new Runner view is comparable UI to the Builder and Coder. If so, I think that Runner should not be translated. What do you think?
- How should return strings of
psychopy.experiment.exports.NameSpace.isPossibleDerivable()
be translated?
When "this" is used as the component name, Builder warns us not to use "this" as the name. This message is not translated.
I searched this string from source codes and found at NameSpace.isPossibleDerivable()
in psychopy/experiment/exports.py.
def isPossiblyDerivable(self, name):
"""catch all possible derived-names, regardless of whether currently
"""
derivable = (name.startswith('this') or
name.startswith('these') or
name.startswith('continue') or
name.endswith('Clock') or
name.lower().find('component') > -1)
if derivable:
return (" Avoid `this`, `these`, `continue`, `Clock`,"
" or `component` in name")
return None
This function is called as follows (in psychopy/app/builder/dialogs/__init__.py).
elif namespace.isPossiblyDerivable(newName):
msg = namespace.isPossiblyDerivable(newName)
return namespace._localized[msg], True
namespace._localized
is defined as (in psychopy/experiment/exports.py)
toTranslate = [
"one of your Components, Routines, or condition parameters",
" Avoid `this`, `these`, `continue`, `Clock`, or `component` in name",
"Builder variable",
"Psychopy module",
"numpy function",
"python keyword"
]
self._localized = {None: ''} # start with this so None=""
for transStr in toTranslate:
self._localized[transStr] = _translate(transStr)
Unfortunately, poedit can't recognize that these strings need to be translated. We have to write them without for
statement.
self._localized[transStr] = [
"one of your Components, Routines, or condition parameters":_translate("one of your Components, Routines, or condition parameters"),
(snip)
"python keyword":_translate("python keyword")
]
On the other hand, we have put pairs of original and translated strings into psychopy/app/builder/localizedStrings.py. Should these strings be moved to localizedStrings.py, too? Or, should they remain as the attribute of NameSpace
object ?