Translation of Submission on Survey Form

23 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Jason Merman

ungelesen,
31.01.2014, 00:34:4331.01.14
an shareab...@googlegroups.com
I created a new shareabouts sites and configured the site to support Spanish and Chinese.  All is working, except on the survey form (place-detail.html), the previous submission values are not getting translated.

For example, on the add place form, I have a 'Day of Week' field:
- prompt: _(Day of Week)
      type: select
      name: day_of_week
      label: _(Day of Week)
      optional: true
      options:
        - label: _(Choose One)
          value: ''
        - label: _(Weekday)
          value: Weekday
        - label: _(Weekend)
          value: Weekend
        - label: _(Monday)
          value: Monday
        - label: _(Tuesday)
          value: Tuesday
        - label: _(Wednesday)
          value: Wednesday
        - label: _(Thursday)
          value: Thursday
        - label: _(Friday)
          value: Friday
        - label: _(Saturday)
          value: Saturday
        - label: _(Sunday)
          value: Sunday
 
NOTE: I want the data in the database to be in English for reporting, so I do not want to encapsulate the value in _(value)
 
On the "Add a Place" form, the select option labels are translated correctly.  The problem is that when the place is submitted and the survey form appears, the selected value are not getting translated (Monday is showing as Monday, not Lunes).

I tried to update the place-detail.html by adding {{#_}} ... {{/_}} around the value, but still no translation:
<p class="place-value place-value-{{ name }}">{{#_}}{{ value }}{{/_}}</p>

Is there any why I can get these values translated on the place-detail.html page?

Thank you all for your help,

JM

Frank Hebbert

ungelesen,
31.01.2014, 08:18:3931.01.14
an shareab...@googlegroups.com
Translations are not dynamic, unfortunately -- when you markup your config file and deploy the site, a file of strings to be translated is produced. Then you manually enter the translations for each item (which it sounds like you already did). This is a one-time thing. When django serves up the content, it uses the translated version on request. So, there's no way for the app to translate the content coming from your database. 

(This is not a technically correct description of how translations work, by the way).

A hacky way to get what you want would be to store a translated value alongside the English one, and then show that in place-detail instead of {{ name }}, using some jquery to determine which language to show. This approach requires you to enter translated strings into your survey as hidden fields that get set depending on the active language. 

--
-- --
Shareabouts Developers group.
Unsubscribe: https://groups.google.com/d/forum/shareabouts-dev?hl=en
---
You received this message because you are subscribed to the Google Groups "Shareabouts Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shareabouts-d...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Frank Hebbert
OpenPlans | http://openplans.org | 720 432-2378 | @fkh
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten