carlxaeron / django-rosetta

Automatically exported from code.google.com/p/django-rosetta
MIT License
0 stars 0 forks source link

Select the default language #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I work mainly on spanish applications, so my key languages are in Spanish.
It would be nice if I could configure rosseta to use a languaje as the one
on which keys are generated.

As a lateral effect the Google translation will work better for people like me.

Original issue reported on code.google.com by antoni.aloy@gmail.com on 13 Nov 2008 at 2:17

GoogleCodeExporter commented 8 years ago
Yes, this makes sense. Will give this a thought

Original comment by mbonetti on 13 Nov 2008 at 2:27

GoogleCodeExporter commented 8 years ago
I attach a patch with let me to select the Default language for the keys and 
solves
the Google translation problem.

I have added two new settings.

MESSAGES_KEY_LANGUAGE=getattr(settings,'ROSETTA_MESSAGES_KEY_LANGUAGE','Spanish'
)
MESSAGES_GOOGLE_ORIGIN=getattr(settings,'ROSETTA_MESSAGES_GOOGLE_ORIGIN','es')

Of course it should be in English in the final version to mantain backwards
compatibility, but the ideas is to define in the settings file the name of the 
key
language you're going to use and the iso name of the origin for google. 

Having a MESSAGES_KEY_LANGUAGE lets me to define the table header, and give a 
name as
"translation-key" as in some projects there si a mix between languages.

It would also be nice to have a "copy" link when the key origin and the 
translation
are similar.

Original comment by antoni.aloy@gmail.com on 14 Nov 2008 at 9:43

Attachments:

GoogleCodeExporter commented 8 years ago
New patch with the copy function.

Original comment by antoni.aloy@gmail.com on 14 Nov 2008 at 10:02

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the patch, Aaloy. I was wondering, wouldn't MESSAGES_GOOGLE_ORIGIN 
be the
same as LANGUAGE_CODE django.conf.settings?

Original comment by mbonetti on 14 Nov 2008 at 10:25

GoogleCodeExporter commented 8 years ago
I was thinking about that but for my own experience I develop web applications 
whose
LANGUAGE_CODE is English but which have the keys in Catalan or Spanish, so it's 
quite
easy to see which content is not marked for translation.

Original comment by antoni.aloy@gmail.com on 14 Nov 2008 at 10:44

GoogleCodeExporter commented 8 years ago
By the way, LANGUAGE_CODE could be the default value

Original comment by antoni.aloy@gmail.com on 14 Nov 2008 at 10:45

GoogleCodeExporter commented 8 years ago
"I develop web applications whose LANGUAGE_CODE is English but which have the 
keys in
Catalan or Spanish"

But isn't this, er... wrong? I was under the impression that LANGUAGE_CODE was 
the
"main" language of the application. Also, gettext recommends (?) the source 
language
to be English.

Original comment by mbonetti on 3 Dec 2008 at 11:05

GoogleCodeExporter commented 8 years ago
Well sometimes there is no english translation but a spanish and catalan for 
example.
Not all the webs are english centric :)

Original comment by antoni.aloy@gmail.com on 3 Dec 2008 at 11:26

GoogleCodeExporter commented 8 years ago
Absolutely, but wouldn't you set LANGUAGE_CODE='es' in this case?

Original comment by mbonetti on 3 Dec 2008 at 11:41

GoogleCodeExporter commented 8 years ago
The idea is:

You're going to develop a web in some languages. Your main language is not 
english,
so the original content is not going to be english. You want to use rosetta to 
let
somebody tranlate the keys.

Actually rosetta assumes that the main language is always english, son the admin
shows english for keys when the main language perhaps is not English, and even 
worse,
the auto translation, via Google, assumes that also, so it not works for 
somebody who
has the main keys in al language that is not English.

with 

MESSAGES_KEY_LANGUAGE=getattr(settings,'ROSETTA_MESSAGES_KEY_LANGUAGE','English'
)
MESSAGES_GOOGLE_ORIGIN=getattr(settings,'ROSETTA_MESSAGES_GOOGLE_ORIGIN','en')

You have the actual configuration for an english centric application, but if 
you can
configure it then with

MESSAGES_KEY_LANGUAGE=getattr(settings,'ROSETTA_MESSAGES_KEY_LANGUAGE',u'Españo
l')
MESSAGES_GOOGLE_ORIGIN=getattr(settings,'ROSETTA_MESSAGES_GOOGLE_ORIGIN','es')

You have a working rosseta for written in spannish, you can also write

MESSAGES_KEY_LANGUAGE=getattr(settings,'ROSETTA_MESSAGES_KEY_LANGUAGE','English'
)
MESSAGES_GOOGLE_ORIGIN=getattr(settings,'ROSETTA_MESSAGES_GOOGLE_ORIGIN',
LANGUAGE_CODE.split('-')[0]) 

but I like best the explicit version and let the final user set the variables 
as he
wants.

Original comment by antoni.aloy@gmail.com on 3 Dec 2008 at 12:55

GoogleCodeExporter commented 8 years ago
Is this fixed in SVN?

Original comment by bcur...@gmail.com on 23 Jul 2009 at 8:01

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi. I did have the same problem. My project main/default language is Portuguese
(settings.LANGUAGE_CODE = 'pt'). So I did modify views.home and rosetta.js
from rosetta version 0.5.1 .

views.py (home view):
project_language_code = settings.LANGUAGE_CODE.split('-')[0]

rosetta.js (line 12):
google.language.translate(orig, '{{project_language_code}}',
'{{rosetta_i18n_lang_code}}',

This project is great.

Original comment by david.kwast on 14 Dec 2009 at 3:32

Attachments:

GoogleCodeExporter commented 8 years ago
david's patch looks ok. I just pulled the svn version but "en" is still 
hard-coded in
the rosetta.js script.
Are there any plans to merge this patch?

Original comment by lwcyphr@gmail.com on 6 Feb 2010 at 8:18

GoogleCodeExporter commented 8 years ago
This is fixed as of r87 (and in the next point release)
Thank you for your patches and support, sorry this took so long.

Original comment by mbonetti on 17 Feb 2010 at 11:40