We want to use symfony's great i18n features for translating our
database records.

When a record is displayed, it should be displayed in the user's
preferred language. If the record is not already translated into the
user's language, it should not be displayed as blank. Instead it
should be displayed in some other language where the record is not
blank. However data entry fields must always contain values in the
user's language, even if those values *are* blank. Otherwise we risk
saving foreign language values as the user's language, so preventing
us from telling whether the record has been translated into the user's
language or not.

So given some record, $record, and some column "title", we currently
use:

A)   $record->getTitle();

- in data entry fields, to get the value of "title" in the user's
language, even if it is blank.

In our templates, we currently use:

B)   <?php if (null === $title = $record->getTitle()) $title = $record-
>getTitle(sfConfig::get('sf_default_culture', 'en')); echo $title ?>

- to get the value of "title" in the user's language if it has been
translated, or in the default language if not.

If I am not already using all of symfony's i18n features for getting
values A) in the user's language and B) in a non-blank language,
please correct me - but our method for getting values in a non-blank
language is quite awkward.

We are considering changing the behavior in our project of $record-
>getTitle(); to instead get the value in a non-blank language (while
respecting the user's language preference) and using $record-
>getTitle($user->getCulture()); in data entry fields to get the value
in the user's language, even if it is blank.

However I'd like to get feedback from symfony's developers - am I
implementing something which is already implemented in symfony? Is
there a better way to accomplish what I describe? Is there a problem
using $record->getTitle(); to get the value in a language which is
possibly not the user's language, if the value in the user's language
is blank?

On a related topic, our records may not all have been created in
"sf_default_culture" - so falling back on "sf_default_culture" if the
record is not available in the user's language may not always work.

To remedy this, we want to store the language each record was created
in, since that is the most authoritative language to display the
record in, and the language in which the record should be displayed if
the user's language preference cannot be satisfied.

So we are considering adding a "source_culture" column to our schema,
and treating it like "created_at" - initializing it to the user's
language (if not already set) when a record is inserted into our
database.

Again, I'd be grateful for feedback from symfony's developers. Does
the ability to tell in which language a record was created already
exist in symfony? Does the ability to initialize a column with the
user's language already exist?

Thanks and best wishes, Jack
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to