imho, i think your define table is redundant if you do like your post above 
e.g. field name1 is redundant with name2.
i think it can be achieve you only create 1 table field called name and 
translate it using T(). define the japanese language translation on the 
languages folder and create new file (jp-romaji.py, jp-kanji.py, 
jp-hiragana.py, jp-katakana.py) after that create the language selector 
like in the admin page.
if you want to set the default language for japanese language (romaji or 
kanji or hiragana or katakana), you can replace the layout.html in the 
views folder
e.g.
<html class="no-js" lang="{{=T.accepted_language or 'en'}}">
for example replace with the japanese file that you've define before 
(jp-romaji.py, jp-kanji.py, jp-hiragana.py, jp-katakana.py)
<html class="no-js" lang="{{=T.accepted_language or 'jp-kanji'}}">

hope this can help

best regards

On Saturday, May 4, 2013 9:42:05 AM UTC-4, Reza Shah wrote:
>
> Hi,
>
> I'm planning a feature which allowed the user to display the content of 
> country name in english or japanese and for item_data name in english, in 
> japanese(kanji) or in japanese pronunciation(kana).
> The target user mostly foreigners which have basic japanese ability, they 
> just use visual ability to match character written in website and in actual 
> product.
> In this context the text in website will be mixed with english and 
> japanese.
>
> With these table structure:
> db.define_table('country',
>     Field('name1', label=T('Name'), unique=True),
>     Field('name2', label=T('Name(Japanese)'), unique=True),
>     format='%(name1)s')
>
> db.define_table('item_data',
>     Field('name1', label=T('Name'), comment=T('Commercial name')),
>     Field('name2', label=T('Name(Romaji)'), comment=T('Product name in 
> romaji')),
>     Field('name3', label=T('Name(Kana)'), comment=T('Product name in 
> kana')),
>     Field('country_id', 'reference country', label=T('Country of Origin'), 
> requires=IS_EMPTY_OR(IS_IN_DB(db, 'country.id', '%(name1)s', orderby=
> db.country.id, zero=T('-- Select product country --'))), represent=lambda 
> id, row: db.country(id).name1 if id else ''),
>     format='%(name1)s')
>
> db.define_table('setting',
>     Field('show_country_in_kanji')
>
>
> What is the best practice for this kind of feature?
> Should i create the table country and table item_data with one name 
> field(english only), how to display it in japanese?
> If the above structure can be used, how to display the 
> item_data.country_id based on user setting  for example in japanese(kanji)?
>
>
> Thanks,
> Reza
>

-- 

--- 
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/groups/opt_out.


Reply via email to