You have found a neat place for the menu path of this Python script!
In trying to translate the menu in French, I hit a 'bone', after some searching the culprit seems to be the second line of the script:
"# -*- coding: iso-8859-15 -*-".
When it is replaced with:
"# -*- coding: utf-8 -*-",
the translation is possible in Linux and Windows. I realise it's not the only way to solve the problem but perhaps the simplest.
Hope this will help this nice script.
Encoding ISO-8859-15 is compatible with all French characters (it's Latin-1 with Euro symbol).
I'm not too used to non-English characters in Python but from what I understand the 'string' syntax constructs a byte string using the specified bytes. Since the output is UTF-8 it may produce incorrect encoding. If you have non-English characters in string literals you should initialize them as "Unicode strings" using the syntax: u'String', for instance u'Chaîne'; Python will then do the transcoding between the encoding in the header and UTF-8 to initialize the string. In that case using:
MENU=u'/Décoration/Onde périodique'
will work, without changing the encoding in the header.
Since I dabble myself in GIMP Python programming, I was aware of a similar solution (u"string" probably not u'string', French often uses the char ' inside string), but it's not the simplest.
Because the average person who want to adapt this script as to program and translate as well, instead of just translating.
"... Since the output is UTF-8 it may produce incorrect encoding..." you are correct if your OS platform is 'Windows' and you want to access the OS directly (like the file system) which is not the case here, no UTF-8 problem with 'Linux' or GIMP.
After just changing the encoding to UTF-8 in the header I have tried it in old 'Win XP' and GIMP 2.6.11 , it works well!
Hope this reassures you.
Comments
Problem for non 'ascii' character
You have found a neat place for the menu path of this Python script!
In trying to translate the menu in French, I hit a 'bone', after some searching the culprit seems to be the second line of the script:
"# -*- coding: iso-8859-15 -*-".
When it is replaced with:
"# -*- coding: utf-8 -*-",
the translation is possible in Linux and Windows. I realise it's not the only way to solve the problem but perhaps the simplest.
Hope this will help this nice script.
Encoding ISO-8859-15 is
Encoding ISO-8859-15 is compatible with all French characters (it's Latin-1 with Euro symbol).
I'm not too used to non-English characters in Python but from what I understand the 'string' syntax constructs a byte string using the specified bytes. Since the output is UTF-8 it may produce incorrect encoding. If you have non-English characters in string literals you should initialize them as "Unicode strings" using the syntax: u'String', for instance u'Chaîne'; Python will then do the transcoding between the encoding in the header and UTF-8 to initialize the string. In that case using:
MENU=u'/Décoration/Onde périodique'
will work, without changing the encoding in the header.
Thank you for your answer
Since I dabble myself in GIMP Python programming, I was aware of a similar solution (u"string" probably not u'string', French often uses the char ' inside string), but it's not the simplest.
Because the average person who want to adapt this script as to program and translate as well, instead of just translating.
"... Since the output is UTF-8 it may produce incorrect encoding..." you are correct if your OS platform is 'Windows' and you want to access the OS directly (like the file system) which is not the case here, no UTF-8 problem with 'Linux' or GIMP.
After just changing the encoding to UTF-8 in the header I have tried it in old 'Win XP' and GIMP 2.6.11 , it works well!
Hope this reassures you.
This is an awesome
Python plugin.
Thanks again Ofnuts for all your great contributions to all us Gimpers out there. :)
Most welcome :-)
As per subject...