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

Get translations without having to call TAPi18n.setLanguage() #5

Open
rijk opened this issue Oct 6, 2014 · 2 comments
Open

Get translations without having to call TAPi18n.setLanguage() #5

rijk opened this issue Oct 6, 2014 · 2 comments

Comments

@rijk
Copy link
Contributor

rijk commented Oct 6, 2014

Although I have no idea to do it yet, it would be nice to be able to get translations for a document without having to call TAPi18n.setLanguage().

A use case for this is the admin panel, where users will input the translations. I currently do this with tabs, switching the language on click, but as a result the whole interface switches language as well. This is not necessarily unwanted, but there’s no way to prevent it if it is. Moreover, if say you wanted to present an <input> fields for each language all in the same form, there’s no way to get the current values AFAIK besides going into the i18n property yourself.

Possible solutions (that I can think of):

  • Add a way to pass a language parameter when fetching the document
  • Have a setLanguage() method on each collection, which’ll override the global current language value
  • Add a getTranslations() method to the collection, to get a key in a defined language (I could then wrap that in a minimongoid method)

I think the last option would be the best, as it’s the only one which’ll also support the use case of displaying multiple languages at the same time.

@Kostanos
Copy link

I'm not sure, but my pull request could help you, check it out - #16

@sagannotcarl
Copy link

I would be very interested in a way to get a translation of a document without changing the language. My use case is the same: A translation interface where you can view the original text next to the fields to input the translated text.

I will try doing what @rijk did with the tabs in the meantime.

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