Python App Engine architecture for entity with multiple languages -


i creating ndb model in app engine called "chair". model have entities names such "blue chair" , "red chair". however, i'd users able store chair property values in multiple languages/locales.

the best approach i've found far have ndb.keyproperty() on chair object called 'language_parent' , string field called "language". key property lookup original chair entity.

is best architecture type of scenario?

assuming displaying names in desired language, better have language string stored in entity itself. example have property names in format of:

name-<iso 639-5 code> 

where iso 639-5 standard 3 letter (alpha-3) codes languages. means english name stored in property called 'name-eng' , 'name-gem' german. 'name' reserved original/default/native language name have direct value display if no language selected.

when retrieve entity, can either directly language property designed (if exists), or loop of property names starting 'name-' find available languages.

with ndb, you'll need use ndb.expando class. can list of properties using special _properties attribute.


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -