Hi,
I have a following database:
db.define_table('language',
Field('code', 'string', unique=True)
)
db.define_table('translation',
Field('language_id', 'reference language', notnull=True, readable=True,
writable=True),
auth.signature
)
db.define_table('language_tr',
Field('translation_id', 'reference translation', notnull=True,
readable=True, writable=True),
Field('language_id', 'reference language', notnull=True, readable=True,
writable=True),
Field('name', notnull=True)
)
So basically I have a list of supported languages in the language table.
Then language_tr table has all names for those languages, in every possible
language. language_id references to the language which is translated and
translation_id references to the translation, which has language_id for the
language which is used for the translation.
In database this works great, but I'm having problems to build a simple
enough database query to get all translations whit selected language only.
For example, user wants to use English and sets that to system language. So
I want to show translations only in English, not with all possible
languages.
What is the most efficient way to get only translations in English?
Basically I'm looking for a list of language_tr elements which has a
translation_id
which has a language_id which is same than users selected system language.
- Marko
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.