Hi,
I wonder if there is a standard in how to deal with i10n data in tables
with SA, I have search google and the documentation but without any success.
For example one has a table for countries were at least the name has to
be translated from e.g. "Germany" to "Deutschland" etc., with a Default
Language if an entry is not found for a particular translation.
My shareware app is currently supporting this but the current
implementation is single user (won't bore you with how I am doing it),
what I would like a multi user solution for this.
I wonder if there is some way of defining this with SA.orm, i.e. have
the following two tables and then some "magic" definition for the
"country" table to get the appropriate translation from the "country_l"
table based on the user selected language and a default language if not
translation is found.
country_table = sa.Table( u'country', metadata,
sa.Column( u'countryid', sa.Integer(),
sa.Sequence('gen_country_countryid'), primary_key=True, nullable=False),
sa.Column( u'dialcode', sa.String(length=10,
convert_unicode=False)),
sa.Column( u'is2code', sa.String(length=2,
convert_unicode=False)),
sa.Column( u'un3code', sa.String(length=3,
convert_unicode=False)),
sa.Column( u'website1', sa.String(length=150,
convert_unicode=False)),
sa.Column( u'website2', sa.String(length=150,
convert_unicode=False)),
sa.Column( u'created', sa.Date()),
sa.Column( u'updated', sa.Date())
)
country_l_table = sa.Table( u'country_l', metadata,
sa.Column( u'id', sa.Integer(),
sa.Sequence('gen_country_l_id'), primary_key= True, nullable= False),
sa.Column( u'fk_countryid', sa.Integer(),
sa.ForeignKey(u'country.countryid'), nullable= False),
sa.Column( u'fk_langid', sa.Integer(),
sa.ForeignKey(u'language.langid'), nullable= False),
sa.Column( u'name', sa.String(length=50,
convert_unicode=False), nullable= False),
sa.Column( u'created', sa.Date()),
sa.Column( u'updated', sa.Date())
)
Any hints or tips on how to do something like this will be very welcome.
Werner
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---