MailingList


SImple question about searching untraslated records

View: New views
2 Messages — Rating Filter:   Alert me  

SImple question about searching untraslated records

by Gianluca Tessarolo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

how can i find all record of translated field that has no translation
loaded ?

Example:

define a model:

class Translation < ActiveRecord::Base
  translates :description
end

working with 2 locales (en-US base and it-IT)

when i create a record for english base locale and after set italian
locale reading the translation: model.description I retrieve the default
value (because Globalize uses coalesce to return the engish description
if italian description is not present).

What can I do to know which translations is not already loadedin italian
locale ?

Thanks in advance.


[Solved] SImple question about searching untraslated records

by Gianluca Tessarolo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've solved from myself.

Simply using this condition only when not in base language:

Translation.find(:all, :conditions => "t_description.text is null")

> Hi,
>
> how can i find all record of translated field that has no translation
> loaded ?
>
> Example:
>
> define a model:
>
> class Translation < ActiveRecord::Base
>  translates :description
> end
>
> working with 2 locales (en-US base and it-IT)
>
> when i create a record for english base locale and after set italian
> locale reading the translation: model.description I retrieve the
> default value (because Globalize uses coalesce to return the engish
> description if italian description is not present).
>
> What can I do to know which translations is not already loadedin
> italian locale ?
>
> Thanks in advance.
>
>
>


--
Gianluca Tessarolo
TreNetMediaMaster S.r.l.
The Internet Technology Company
Telefono +39(049)776196
Fax +39(049)8087806
Visit us @: http://www.trenet.it - http://www.mediamaster.it
e-mail me @: tessarolo.gianluca@...
----------------------------------------------------------------------
Le informazioni trasmesse sono destinate esclusivamente alla persona o
alla società in indirizzo e sono da intendersi confidenziali e riservate.
Ogni trasmissione, inoltro, diffusione o altro uso di queste
informazioni a persone o società differenti dal destinatario é proibita.
Se ricevete questa comunicazione per errore, contattate il mittente e
cancellate le informazioni da ogni computer.