How to format string on I18n

10 views
Skip to first unread message

Tsung-Hsien

unread,
Dec 5, 2011, 1:07:30 AM12/5/11
to Django users
Hello
I get the wrong message when type a string which needed to format
such as

msgid "An inviatation was sent to %(email)s."
msgstr "邀請已送到%(email)s"

------------------------------------------------------------------------------------------
Incorrect string value: '\xE9\x82\x80\xE8\xAB\x8B...' for column
'message' at row 1
------------------------------------------------------------------------------------------
How to fix it?
Thanks!!

Mimi Tantono

unread,
Dec 5, 2011, 1:45:37 AM12/5/11
to django...@googlegroups.com
Please look at the thread below:

And you would want to make sure that database encoding style is already set to UTF-8 (if applicable).

2011/12/5 Tsung-Hsien <jasoni...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--


Best Regards,

Mimi Tantono

It is always hard to do new things, and it should be getting even harder along the time because then it indicates that we are improving.

Tsung-Hsien

unread,
Dec 5, 2011, 7:05:45 AM12/5/11
to Django users
Thank you!
the default character of MySQL does not utf-8, so after altering the
character, the message can show on the page.
However, the message shows only English, except I don't use the %
(email)s.
I have been delete the "#, fuzzy" and remain the "#, python-format",
but the string still show English.

How to solve this?
thanks!!

On Dec 4, 10:45 pm, Mimi Tantono <momot...@glomelurus.com> wrote:
> Please look at the thread below:http://stackoverflow.com/questions/873419/converting-to-safe-unicode-...


>
> And you would want to make sure that database encoding style is already set
> to UTF-8 (if applicable).
>

> 2011/12/5 Tsung-Hsien <jasoniem9...@gmail.com>


>
>
>
>
>
>
>
>
>
> > Hello
> > I get the wrong message when type a string which needed to format
> > such as
>
> > msgid "An inviatation was sent to %(email)s."
> > msgstr "邀請已送到%(email)s"
>
> > --------------------------------------------------------------------------- ---------------
> > Incorrect string value: '\xE9\x82\x80\xE8\xAB\x8B...' for column
> > 'message' at row 1
>
> > --------------------------------------------------------------------------- ---------------
> > How to fix it?
> > Thanks!!
>
> > --
> > You received this message because you are subscribed to the Google Groups

> > "Django users" group.> To post to this group, send email todjang...@googlegroups.com.


> > To unsubscribe from this group, send email to>django-users...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
>
> Best Regards,
>

> Mimi Tantono <http://www.glomelurus.com>
>
> *It is always hard to do new things, and it should be getting even harder
> along the time because then it indicates that we are improving.*

rskm1

unread,
Dec 5, 2011, 7:46:50 PM12/5/11
to Django users
On Dec 5, 6:05 am, Tsung-Hsien <jasoniem9...@gmail.com> wrote:
> I have been delete the "#, fuzzy" and remain the "#, python-format",
> but the string still show English.

You do need to remove the ", fuzzy" in order for the translations to
be used.
But you also need to recompile the .mo files after you make any
changes to the .po files.
https://docs.djangoproject.com/en/1.3/topics/i18n/localization/#compiling-message-files

李 强

unread,
Jan 4, 2012, 1:14:54 AM1/4/12
to django...@googlegroups.com
Lack of a full stop,maybe.

> --
> You received this message because you are subscribed to the Google Groups "Django users" group.

> To post to this group, send email to django...@googlegroups.com.

Krator Ado

unread,
Jan 4, 2012, 4:31:31 AM1/4/12
to django...@googlegroups.com
msgid u"邀請已送到%(email)s"
and add "# coding=utf-8" at the first line of your .py file.

2012/1/4 李 强 <lees...@gmail.com>



--
物竞天择,适者生存。
Reply all
Reply to author
Forward
0 new messages