Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placeholder text and search terms from lists not translated #595

Open
declan opened this issue Sep 9, 2014 · 3 comments
Open

Placeholder text and search terms from lists not translated #595

declan opened this issue Sep 9, 2014 · 3 comments

Comments

@declan
Copy link
Contributor

declan commented Sep 9, 2014

Google Translate will translate the text of the search links on the bottom of the homepage, but does not translate the search terms in the URL itself. Also, placeholder text is not translated. For example, when I set the website language to spanish and click "Seguro de Salud" I end up with this:

image

You're probably already aware of this problem, and I was just wondering if you had plans to fix it and/or thoughts about the best way to address it.

@anselmbradford
Copy link
Member

Thanks for the notes @declan. For the first one when you enter text and do a keyword search in a language other than English it should use the language detection of the Google Translate API... however this is a paid feature, do you have https://github.com/codeforamerica/ohana-web-search/blob/master/config/application.example.yml#L52 set? If you do, this may be a bug.

The other one is a Google Translate quirk as far as I know. It doesn't translate text in an attribute, which the placeholder text is. The work around for this would probably be something like: include a hidden div inside the input (set to visibility:hidden or display:none or whatever Google Translate would recognize) that has the same text as the placeholder attribute. When the page is translated, the hidden divs will contain a element injected by Google that has the translated text. Take the value of the hidden field's text and replace the placeholder attributes with that value. This is a refinement on the translation feature that is out of scope for the work we'll be doing in the next few months unfortunately, but happy to review any solutions if something's built on your end. The translation is meant to make the content accessible, but it isn't perfect. For instance, another refinement that's out of scope would be adjusting the text layout when the page is translated into a right-to-left running language, such as arabic.

@monfresh
Copy link
Member

monfresh commented Sep 9, 2014

In addition to what Ans said, if you know that you have a large majority of your users that would prefer to use the site in a particular language, you can translate the links on the homepage yourself and point them to a different locale that uses that language.

For example, if you wanted to have the links and other text be automatically be displayed in Spanish, you would create a file in config/locales called es.yml, and copy and paste the contents of en.yml and then translate everything in Spanish.

Then, you could create a subdomain for the Spanish version of your site, and have it use the es.yml, as described here:
http://guides.rubyonrails.org/i18n.html#setting-the-locale-from-the-domain-name

If you go that route, you will obviously need to sign up for the paid Google Translate service because the search terms will be in Spanish, but will have to be translated to English to perform the correct search.

@declan
Copy link
Contributor Author

declan commented Sep 10, 2014

Ok, thanks for the pointers, and thanks for clarifying what's in scope for the next few months. It makes sense that the translated versions of the site might not reach the same level of polish as the English version.

Feel free to close this issue if you want, and I'll keep you up to date if we do any work on our end to refine this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants