[web2py] Re: Unable to edit language files

2010-11-17 Thread pierreth
On Nov 17, 1:51 am, JmiXIII sylvn.p...@gmail.com wrote:
 Salut ! :)
 What about having a look there 
 :)https://groups.google.com/group/web2py-users-france?hl=fr


This is cool. I already did the translation. This is not a big
project. Now, we need to verify before integrated it. :-)

I am waiting approbation for the group.


[web2py] Re: Unable to edit language files

2010-11-16 Thread pierreth
I discover that the method T.translate is writing the current
dictionary in memory to the file when a word is not found. This is
causing me problems because I am changing my language files as I need.

Is it possible to deactivate this behavior?


[web2py] Re: Unable to edit language files

2010-11-16 Thread mdipierro
I am still trying to understand why this is a problem.

web2py loads the langauge in ram, and uses. It finds a T(var) and var
is not in dictionary, it assumes it needs to be translated, adds it to
the dict and saves it on file.

Somehow your code breaks this. How?
What is the purpose of your code? Where is it, in a model?

On Nov 16, 2:39 pm, pierreth pierre.thibau...@gmail.com wrote:
 I discover that the method T.translate is writing the current
 dictionary in memory to the file when a word is not found. This is
 causing me problems because I am changing my language files as I need.

 Is it possible to deactivate this behavior?


[web2py] Re: Unable to edit language files

2010-11-16 Thread pierreth
On Nov 16, 6:23 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I am still trying to understand why this is a problem.

 web2py loads the langauge in ram, and uses. It finds a T(var) and var
 is not in dictionary, it assumes it needs to be translated, adds it to
 the dict and saves it on file.
 Somehow your code breaks this. How?
 What is the purpose of your code? Where is it, in a model?

OK, I did a re-factoring of my code and everything is now fine and I
have no bug. No more worry.

My application is in English with translation in French. I wanted to
be able to use codes for long texts. This means to always do the
translation and look up in the en.py file when I use these codes.

Also, I wanted to use specific language files in some cases.

Now, my application works in French. Would you like the file? It
enables web2py in French.


[web2py] Re: Unable to edit language files

2010-11-16 Thread pierreth
On Nov 16, 6:23 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I am still trying to understand why this is a problem.

 web2py loads the langauge in ram, and uses. It finds a T(var) and var
 is not in dictionary, it assumes it needs to be translated, adds it to
 the dict and saves it on file.
 Somehow your code breaks this. How?
 What is the purpose of your code? Where is it, in a model?

OK, I did a re-factoring of my code and everything is now fine and I
have no bug. No more worry.

My application is in English with translation in French. I wanted to
be able to use codes for long texts. This means to always do the
translation and look up in the en.py file when I use these codes.

Also, I wanted to use specific language files in some cases.

Now, my application works in French. Would you like the file? It
enables web2py in French.


[web2py] Re: Unable to edit language files

2010-11-16 Thread JmiXIII
Salut ! :)
What about having a look there :)
https://groups.google.com/group/web2py-users-france?hl=fr


On 17 nov, 06:06, pierreth pierre.thibau...@gmail.com wrote:
 On Nov 16, 6:23 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I am still trying to understand why this is a problem.

  web2py loads the langauge in ram, and uses. It finds a T(var) and var
  is not in dictionary, it assumes it needs to be translated, adds it to
  the dict and saves it on file.
  Somehow your code breaks this. How?
  What is the purpose of your code? Where is it, in a model?

 OK, I did a re-factoring of my code and everything is now fine and I
 have no bug. No more worry.

 My application is in English with translation in French. I wanted to
 be able to use codes for long texts. This means to always do the
 translation and look up in the en.py file when I use these codes.

 Also, I wanted to use specific language files in some cases.

 Now, my application works in French. Would you like the file? It
 enables web2py in French.


[web2py] Re: Unable to edit language files

2010-11-15 Thread pierreth
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?


[web2py] Re: Unable to edit language files

2010-11-14 Thread mdipierro


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


 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.