'Hidden feature!' to the tune of:

http://www.youtube.com/watch?v=JmtD4-WfhMw

It's cool, but we can get rid of it if we're certain we're gonna go with
just using the language of the author. Might be useful down the road,
though.


On Mon, Feb 10, 2014 at 11:12 AM, john irving <notifications@github.com>wrote:

> In app/models/concerns/translatable.rb:
>
> >
> > -  def translate(from_lang, to_lang)
> > -    translator.translate(body, from: from_lang || detect_lang, to: to_lang) if can_translate? from_lang, to_lang
> > +  def translate(from_lang = author.primary_language, to_lang = I18n.locale.to_s)
> > +    return {} if translator.nil? || to_lang.blank? || from_lang == to_lang
> > +    current_translations = self.translations.to_language(to_lang)
> > +
> > +    self.class.translatable_fields.each do |field|
> > +      if current_translations.where(translatable_field: field).empty?
> > +        translated = translator.translate(self.send(field),
> > +                                          from: from_lang || detect_lang(field),
>
> I like this detect_lang, but can't see a context where it will get to this
> or, because line def translate(from_lang = author.primary_language,
> to_lang = I18n.locale.to_s) sets default from_lang
> a user would have to pass false to reach detect_lang yeah?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/loomio/loomio/pull/1281/files#r9571205>
> .
>