Open archonic opened 9 years ago
It does not look like the translations were ever implemented in full. "survey_translations" only references survey_id and not any of the translatable models like Question or Answer with their own text fields, so it would not be very useful.
@archonic the UI (prompts, buttons, etc.) is localized separately from the text of the questions/answers themselves
@prusswan translations were implemented in full - they are simply linked through the survey, not via individual models
@yoon Okay, I saw the yaml files, but initially I assumed they are just part of DSL, and not also used for retrieving the translations.
Edit:
It seems to be working on my end, the yaml content for the entire survey is stored in the SurveyTranslation model. One caveat however is that the questions and answers (or any other fields to be translated) must have reference identifiers, which cannot be just numbers, since they will just end up as numeric keys in hash returned from parsing the yaml content, and translates
finds the translation by reference_identifier
(which is a string key). This can be fixed by something like deep_stringify_keys
, which is available in Rails 4.
The app is translating just fine but survey pages are set to the default.
SurveyorController extends ApplicationController where the local is populated, so I don't see why setting the locale in SurveyorController would change anything, but it did. Setting the locale in SurveyorController has the survey pages translate, but the survey content is set to default. The database translation requests (I know there's a PR to remove these) are set to "fr" but are still rendering "en" content:
I checked the value of
I18n.locale
in _answer.html.haml and it was also fr. Pretty odd.Any ideas what I could be doing wrong?