Can you clarify. I wouldnt recommend using dbgettext implentation seems way 
too complex for your needs currently and it is only in 0.1 according to 
readthedocs.

One I might suggest that looks simple enough in implementation is 
vinaigrette https://github.com/ecometrica/django-vinaigrette

Very simple easy to use interface, enforces the idea that you creating a 
table of translation to be maintained, you can activate languages. 

Also gettext will expire messages that it can no longer find in the code. 
This supports a --keep-obsolete command in case you plan to reintegrate a 
page removed from the active repo.



On Friday, April 19, 2013 5:35:28 PM UTC-4, Cody Scott wrote:
>
> I installed dbgettext and it allows you to mark model fields and then 
> export them with dbgettext_export. Then when you run django-admin.py 
> makemessages it includes the content in the .po file.
>
> Then you use django-admin.py compilemessages like normal.
>
> The only problem I am having is that only three words are being translated.
>
> Home (which was not from the database), Yes and No.
>
> Also I keep getting switched to the english version of the site with the 
> url having /en/ in the beginning while I set it to /ja/
>
>
> On Fri, Apr 19, 2013 at 5:02 PM, Daniel Krol <orbl...@gmail.com<javascript:>
> > wrote:
>
>> Oh, just to be clear, the hack involves putting the content into the 
>> template, and marking it for translation.
>>
>>
>> On Friday, April 19, 2013 1:57:44 PM UTC-7, Daniel Krol wrote:
>>>
>>> There isn't anything built into Django to translate the content of 
>>> models. This is because the GNU gettext system that Django uses for 
>>> translation stores the original->translation mappings in a "compiled" file 
>>> which only changes between restarts of the server. That means anything you 
>>> dynamically create in the database cannot be translated with this system, 
>>> at least without a sort of a hack.
>>>
>>> And the hack is this: If you have access to the data from the live 
>>> database from your development environment, you could theoretically dump it 
>>> (the actual full text verbatim, not just a variable containing the 
>>> content), to a dummy template file. Then, makemessages will pick up that 
>>> text and put it into the translation files. *then* you can translate it, 
>>> and say {% trans model_instance.field %}. Where I work, we've done this for 
>>> very small pieces of data (category names, of which there are less than 
>>> 10). It's manageable at this point. But with full blog posts, unless you 
>>> automate some sort of system, it's probably way too big a hack to be worth 
>>> it. (You'd have to make sure your spacing was 100% correct, too.)
>>>
>>> No, what I recommend is to create a model in the database that serves as 
>>> the translated version of all the specific models whose content you want to 
>>> translate. For instance, you want BlogPostTranslation, with an FK to 
>>> BlogPost, and also a locale. Then in your view, you select the appropriate 
>>> translation to show based on the locale in the request 
>>> (request.LANGUAGE_CODE).
>>>
>>> Since this is somewhat of a common concern, there are libraries out 
>>> there that facilitate this. I won't list them because I have no 
>>> recommendations on the matter (I have not tried any personally), your own 
>>> Google search will be as good as mine. But look for things along the line 
>>> of "django model translation".
>>>
>>> Hope this helps.
>>>
>>> On Tuesday, April 16, 2013 9:15:40 AM UTC-7, Cody Scott wrote:
>>>>
>>>> I want the end user of the site to be able to view the site in 
>>>> different languages.
>>>>
>>>> I have marked the static text in my templates for translation. I have 
>>>> not marked the verbose_names because they are used in the admin which the 
>>>> end user will not have access to.
>>>>
>>>> But I just realized that the actually content in the database needs to 
>>>> be translated. If it was a blog site the blog posts which are stored in 
>>>> the 
>>>> database would also need to be translated.
>>>>
>>>> How do I mark them for translation?
>>>>
>>>> How can I see the site in a different language. In the tutorial is says 
>>>> you can see the admin section in a different language how do I do that?
>>>>
>>>>  -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/upzy6ohwlKc/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to