Problems adding a new language flag to Plone

2 messages Options
Embed this post
Permalink
albertpt

Problems adding a new language flag to Plone

Reply Threaded More More options
Print post
Permalink
Hi everybody,

I'm struggling trying to add a new language flag to Plone. The version I'm running is 3.2.2, under Windows.

The case is that I wanted to add a flag to the Catalan language, which is currently missing on Plone. To do that, I took a look on the filesystem, and I found that all the languages flags seemed to be on the Plone.i18n-1.0.7 product, on the \buildout-cache\eggs folder. So I downloaded the source 'plone.i18n-1.0.7.zip' file to be able to modify it and install it.

So, after playing a bit, I concluded that all that it was needed was:

        1) Create a new .gif file of the falg, having the same size of the rest. So I created a flag for the Catalan language and I put it on the same folder as the euskera one (also from Spain), that is, the \plone.i18n\plone\i18n\locales\browser\language-flags folder.

        2) I updated the languages.py file, located on the \plone\i18n\locales folder, adding the corresponding link on the language line to the new flag:

u'ca' : {u'native' : 'Català', u'name' : 'Catalan'},u'flag' : '/++resource++language-flags/ca.gif'},
       

Finally, I saved the file and I tried to create an egg for the product, to see if the \build folder would contain the new flag. So, I run:

python setup.py bdist_egg

But after the execution, the flag was not created. Then, I redirected the sdtout to a file to capture the output, and then I was able to see the following error on the command line after the execution:

C:\Archivos de programa\Plone\src\plone.i18n-1.0.7\plone.i18n>"c:\Archivos de pr
ograma\Plone\python\python.exe" setup.py bdist_egg > EggLog.txt
  File "build\bdist.win32\egg\plone\i18n\locales\languages.py", line 93
    u'co' : {u'native' : 'Corsu', u'name' : 'Corsican'},
          ^
SyntaxError: invalid syntax

This language, Corsican, is the next one after the Catalan language, and after the newly added code. So I assume that something is wrong with this added code...

Moreover, the execution does not generate any .pyc file on the \locales folder for the languages.py, countries.py, etc.. files. Instead, if I remove the added code to the catalan language (that is, leaving the product by default) and I try to generate th egg again, all goes ok and the .pyc files are generated.


So, my questions are:

1) Am I doing something wrong or am I skipping any step? I don't understand why the new flag is creating the error...

2) If we finally manage to have the flag correctly recognized, will the installation of the product overwrite the currently existing one (same version)?

I hope you will be able to give me some light on this problem...

Best regards,
Albert.
jalucena

Re: Problems adding a new language flag to Plone

Reply Threaded More More options
Print post
Permalink
Hola Albertpt

I had the same problem and solved it.
Really, if you see carefully the new code you added to languages.py, there is a inconvenient '}' in it:

u'ca' : {u'native' : 'Català', u'name' : 'Catalan'         }            ,u'flag' : '/++resource++language-flags/ca.gif'},

(sorry i don't know another way to remark than isolate the symbol)

You only have to erase this symbol and everything will be fine.
Saludos

albertpt wrote:
Hi everybody,

I'm struggling trying to add a new language flag to Plone. The version I'm running is 3.2.2, under Windows.

The case is that I wanted to add a flag to the Catalan language, which is currently missing on Plone. To do that, I took a look on the filesystem, and I found that all the languages flags seemed to be on the Plone.i18n-1.0.7 product, on the \buildout-cache\eggs folder. So I downloaded the source 'plone.i18n-1.0.7.zip' file to be able to modify it and install it.

So, after playing a bit, I concluded that all that it was needed was:

        1) Create a new .gif file of the falg, having the same size of the rest. So I created a flag for the Catalan language and I put it on the same folder as the euskera one (also from Spain), that is, the \plone.i18n\plone\i18n\locales\browser\language-flags folder.

        2) I updated the languages.py file, located on the \plone\i18n\locales folder, adding the corresponding link on the language line to the new flag:

u'ca' : {u'native' : 'Català', u'name' : 'Catalan'},u'flag' : '/++resource++language-flags/ca.gif'},
       

Finally, I saved the file and I tried to create an egg for the product, to see if the \build folder would contain the new flag. So, I run:

python setup.py bdist_egg

But after the execution, the flag was not created. Then, I redirected the sdtout to a file to capture the output, and then I was able to see the following error on the command line after the execution:

C:\Archivos de programa\Plone\src\plone.i18n-1.0.7\plone.i18n>"c:\Archivos de pr
ograma\Plone\python\python.exe" setup.py bdist_egg > EggLog.txt
  File "build\bdist.win32\egg\plone\i18n\locales\languages.py", line 93
    u'co' : {u'native' : 'Corsu', u'name' : 'Corsican'},
          ^
SyntaxError: invalid syntax

This language, Corsican, is the next one after the Catalan language, and after the newly added code. So I assume that something is wrong with this added code...

Moreover, the execution does not generate any .pyc file on the \locales folder for the languages.py, countries.py, etc.. files. Instead, if I remove the added code to the catalan language (that is, leaving the product by default) and I try to generate th egg again, all goes ok and the .pyc files are generated.


So, my questions are:

1) Am I doing something wrong or am I skipping any step? I don't understand why the new flag is creating the error...

2) If we finally manage to have the flag correctly recognized, will the installation of the product overwrite the currently existing one (same version)?

I hope you will be able to give me some light on this problem...

Best regards,
Albert.