On Nov 15, 12:19 am, mdipierro <
mdipie...@cs.depaul.edu> wrote:
> On Nov 14, 7:00 pm, pierreth <
pierre.thibau...@gmail.com> wrote:
>
> > Hello,
>
> > I've tried to edit my language files but my changes are all the time
> > overwritten.
>
> Do you use windows? If so, do you Mark hammond win32 extesions
>
No. OpenSuse 11.3.
>
>
> > When I use the web interface of web2py to edit these files, some
> > fields are in yellow. What is the meaning of this?
>
> It means the translation is the same as the original so probably they
> were not translated.
>
> > How should I edit these files to have permanent changes?
>
> There is a button at the end. When you save them they should be
> permanent. Can you help isolate what causes them to be overwritten. I
> cannot reproduce it.
May it is my code. Here I have some code manipulating the translator:
def translate(word, language, T):
"""
Force the translation of "word" in "language".
Restore the state of T before returning.
@param word: Word or text translate.
@param language: The language used by the translator.
@param T: The usual "T" translator.
@return: The text translated in the requested language.
"""
accepted_language = T.accepted_language
language_file = T.language_file
lazy = T.lazy
try:
if language == None:
language = "en"
T.force(language)
T.lazy = False
return T(word)
finally:
T.accepted_language = accepted_language
T.language_file = language_file
T.lazy = lazy
def translate_fallback(word, T, fallback=None):
"""
Try to do a translation like T(word) and fall back on a fall back
language if it does not work.
Restore the state of T before returning.
@param word: Word or text translate.
@param T: The usual "T" translator.
@param fallback: The fall back language to used if the translation
fail.
If None, T.current_languages will be used.
@return: The text translated.
"""
current_languages = T.current_languages
try:
T.set_current_languages(None)
result = str(T(word))
if result == word:
T.force(fallback or current_languages)
result = str(T(word))
return result
finally:
T.set_current_languages(current_languages)
Could this be the problem?