[pgadmin-hackers] pgAdmin4 Chinese (Simplified) translation Patch

2016-11-13 Thread lambda

Hi all,
i've done the chinese (Simplified) transation of pgadmin4, and the 
attachment is the patch, hope to add the mainline.
   
Does I need do 'pybabel compile -d web/pgadmin/translations' to generate 
the catalogues can be used, i have not generate it yet,
if it is needed, i will add it the next time.

Regards,
-- 
tingting hui
https://my.oschina.net/innovation 




simple_chinese_translation.patch.gz
Description: GNU Zip compressed data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] pgAdmin4 Chinese (Simplified) translation Patch

2016-11-13 Thread lambda
for the first question, pybabel support Chinese with zh_Hans_CN
#pybabel  --list-locales |grep zh
b'zh   Chinese'
b'zh_Hans  Chinese (Simplified)'
b'zh_Hans_CN   Chinese (Simplified, China)'
b'zh_Hans_HK   Chinese (Simplified, Hong Kong SAR China)'
b'zh_Hans_MO   Chinese (Simplified, Macau SAR China)'
b'zh_Hans_SG   Chinese (Simplified, Singapore)'
b'zh_Hant  Chinese (Traditional)'
b'zh_Hant_HK   Chinese (Traditional, Hong Kong SAR China)'
b'zh_Hant_MO   Chinese (Traditional, Macau SAR China)'
b'zh_Hant_TW   Chinese (Traditional, Taiwan)'
   2.for the compile error, it seems an bug in pybabel choose ignore it, it 
well ok.in my vim , line 7283 nearly it highlights '% u' in " 20% use"

i do not known why both '%' and 'u' high here.
in my laptop, although it make an error massage as you show, it 
generate the  po file ok!
   now i update the  7283 line  with '20%  use'  with '20%\  use'
   it will compile  without errror,
   attatchment is  updated version.
   Thank you!

regards
-
tingting.hui








At 2016-11-13 19:02:51, "Dave Page"  wrote:
>Hi!
>
>On Sun, Nov 13, 2016 at 8:34 AM, lambda  wrote:
>>
>> Hi all,
>> i've done the chinese (Simplified) transation of pgadmin4, and the
>> attachment is the patch, hope to add the mainline.
>
>Awesome!
>
>As this is the first translation, we're expecting some problems:
>
>- Have you tested the app? When I ran it, I found a number of strings
>that didn't seem to be translated; but I don't know if that's
>intentional, if your work isn't yet finished, or we've missed
>translation markers.
>
>- I could only get the translation to work if I marked it as 'zh' in
>the config. 'zh_CN' caused an error in Babel (it didn't like the _),
>and zh_Hans_CN isn't offered as an accepted language by Chrome. Is
>'zh' OK?
>
>- When compiling, I got the following error:
>
>(pgadmin4)piranha:web dpage$ pybabel compile -d pgadmin/translations
>error: pgadmin/translations/zh_Hans_CN/LC_MESSAGES/messages.po:7283:
>placeholders are incompatible
>compiling catalog
>pgadmin/translations/zh_Hans_CN/LC_MESSAGES/messages.po to
>pgadmin/translations/zh_Hans_CN/LC_MESSAGES/messages.mo
>
>
>> Does I need do 'pybabel compile -d web/pgadmin/translations' to generate
>> the catalogues can be used, i have not generate it yet,
>> if it is needed, i will add it the next time.
>
>I don't mind - it's easy enough for me to do, but you probably should
>do it to test.
>
>Thanks!
>
>-- 
>Dave Page
>Blog: http://pgsnake.blogspot.com
>Twitter: @pgsnake
>
>EnterpriseDB UK: http://www.enterprisedb.com
>The Enterprise PostgreSQL Company
>
>
>-- 
>Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>To make changes to your subscription:
>http://www.postgresql.org/mailpref/pgadmin-hackers


simple_chinese_translation-V2.patch.gz
Description: GNU Zip compressed data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] pgAdmin4 Chinese (Simplified) translation Patch

2016-11-14 Thread lambda



with  web/config.py  add

```
LANGUAGES = {
  'zh_cn' : 'zh_CN',
  'en' : 'English'
}

```
ok ?




在 2016-11-14 20:16:47,"Khushboo Vashi"  写道:





On Mon, Nov 14, 2016 at 5:37 PM, Dave Page  wrote:
Hi

(Khushboo, please see below)

On Sun, Nov 13, 2016 at 1:26 PM, lambda  wrote:
> for the first question, pybabel support Chinese with zh_Hans_CN
>
> #pybabel  --list-locales |grep zh
> b'zh   Chinese'
> b'zh_Hans  Chinese (Simplified)'
> b'zh_Hans_CN   Chinese (Simplified, China)'
> b'zh_Hans_HK   Chinese (Simplified, Hong Kong SAR China)'
> b'zh_Hans_MO   Chinese (Simplified, Macau SAR China)'
> b'zh_Hans_SG   Chinese (Simplified, Singapore)'
> b'zh_Hant  Chinese (Traditional)'
> b'zh_Hant_HK   Chinese (Traditional, Hong Kong SAR China)'
> b'zh_Hant_MO   Chinese (Traditional, Macau SAR China)'
> b'zh_Hant_TW   Chinese (Traditional, Taiwan)'

Right, but if I try to match with 'zh-CN' (which is what Chrome offers
for Chinese Simplified), then I get:

2016-11-14 11:53:52,919: INFO werkzeug: 127.0.0.1 - - [14/Nov/2016
11:53:52] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 2000, in __call__
return self.wsgi_app(environ, start_response)
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1567, in handle_exception
reraise(exc_type, exc_value, tb)
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1988, in wsgi_app
response = self.full_dispatch_request()
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1634, in full_dispatch_request
self.try_trigger_before_first_request_functions()
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1660, in try_trigger_before_first_request_functions
func()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/__init__.py", line
42, in create_module_preference
self.register_preferences()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/__init__.py",
line 192, in register_preferences
gettext("Show system objects?"), 'boolean', False,
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_babel/__init__.py",
line 539, in gettext
t = get_translations()
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_babel/__init__.py",
line 216, in get_translations
catalog = support.Translations.load(dirname, [get_locale()])
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_babel/__init__.py",
line 248, in get_locale
locale = Locale.parse(rv)
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/core.py",
line 270, in parse
parts = parse_locale(identifier, sep=sep)
  File 
"/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/core.py",
line 1096, in parse_locale
raise ValueError('expected only letters, got %r' % lang)
ValueError: expected only letters, got 'zh-cn'

zh_Hans_CN isn't offered by the browser at all, so that doesn't work.

Maybe the answer is to not use the browser's language negotiation at
all, but make it a configurable setting?

>2.for the compile error, it seems an bug in pybabel choose ignore it,
> it well ok.in my vim , line 7283 nearly it highlights '% u' in " 20% use"
> i do not known why both '%' and 'u' high here.
> in my laptop, although it make an error massage as you show, it
> generate the  po file ok!
>now i update the  7283 line  with '20%  use'  with '20%\  use'
>it will compile  without errror,
>attatchment is  updated version.
>Thank you!

In testing I found a couple of issues:

1) We weren't extracting strings from SQL templates for translation

2) Strings in some of the dashboards weren't marked for translation

I've fixed those two issues and updated the template. Can you please
update your translation?

Khushboo; I also noticed that the treeview collection labels aren't
getting translated. Can you look to see why please?




Sure. Will look into this.
 
Thanks.


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company




Re: [pgadmin-hackers] pgAdmin4 Chinese (Simplified) translation Patch

2016-11-14 Thread lambda


Hi,
this is the new updated version,
thank you!
:)








At 2016-11-14 23:41:21, "Dave Page"  wrote:
>Hi
>
>On Mon, Nov 14, 2016 at 3:22 PM, lambda  wrote:
>>
>>
>> with  web/config.py  add
>>
>> ```
>> LANGUAGES = {
>>   'zh_cn' : 'zh_CN',
>>   'en' : 'English'
>> }
>> ```
>> ok ?
>
>Hmm, I'm sure that failed yesterday - I remember debugging it! It's
>working now though, so let's use zh_cn.
>
>BTW; the second field above is just a label, so I'd probably put
>"Chinese (Simplified)" in there.
>
>Can you update your catalog with the latest changes please?
>
>> 在 2016-11-14 20:16:47,"Khushboo Vashi"  写道:
>>
>>
>>
>> On Mon, Nov 14, 2016 at 5:37 PM, Dave Page  wrote:
>>>
>>> Hi
>>>
>>> (Khushboo, please see below)
>>>
>>> On Sun, Nov 13, 2016 at 1:26 PM, lambda  wrote:
>>> > for the first question, pybabel support Chinese with zh_Hans_CN
>>> >
>>> > #pybabel  --list-locales |grep zh
>>> > b'zh   Chinese'
>>> > b'zh_Hans  Chinese (Simplified)'
>>> > b'zh_Hans_CN   Chinese (Simplified, China)'
>>> > b'zh_Hans_HK   Chinese (Simplified, Hong Kong SAR China)'
>>> > b'zh_Hans_MO   Chinese (Simplified, Macau SAR China)'
>>> > b'zh_Hans_SG   Chinese (Simplified, Singapore)'
>>> > b'zh_Hant  Chinese (Traditional)'
>>> > b'zh_Hant_HK   Chinese (Traditional, Hong Kong SAR China)'
>>> > b'zh_Hant_MO   Chinese (Traditional, Macau SAR China)'
>>> > b'zh_Hant_TW   Chinese (Traditional, Taiwan)'
>>>
>>> Right, but if I try to match with 'zh-CN' (which is what Chrome offers
>>> for Chinese Simplified), then I get:
>>>
>>> 2016-11-14 11:53:52,919: INFO werkzeug: 127.0.0.1 - - [14/Nov/2016
>>> 11:53:52] "GET / HTTP/1.1" 500 -
>>> Traceback (most recent call last):
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>>> line 2000, in __call__
>>> return self.wsgi_app(environ, start_response)
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>>> line 1991, in wsgi_app
>>> response = self.make_response(self.handle_exception(e))
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>>> line 1567, in handle_exception
>>> reraise(exc_type, exc_value, tb)
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>>> line 1988, in wsgi_app
>>> response = self.full_dispatch_request()
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>>> line 1634, in full_dispatch_request
>>> self.try_trigger_before_first_request_functions()
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>>> line 1660, in try_trigger_before_first_request_functions
>>> func()
>>>   File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/__init__.py", line
>>> 42, in create_module_preference
>>> self.register_preferences()
>>>   File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/__init__.py",
>>> line 192, in register_preferences
>>> gettext("Show system objects?"), 'boolean', False,
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_babel/__init__.py",
>>> line 539, in gettext
>>> t = get_translations()
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_babel/__init__.py",
>>> line 216, in get_translations
>>> catalog = support.Translations.load(dirname, [get_locale()])
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_babel/__init__.py",
>>> line 248, in get_locale
>>> locale = Locale.parse(rv)
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/core.py",
>>> line 270, in parse
>>> parts = parse_locale(identifier, sep=sep)
>>>   File
>>>