java - Advice on how to handle Internationalization when there is a Database in the middle of the way -


my site allows user choose language. texts shown in website handled reloadableresourcebundlemessagesource of spring, reads texts properties files.

i have menu many links, taken database.

my question is: should write different languages text of links? what's best practice?

1) write languages inside dabatase? example way?

-------------------------------------------------- | id_link |   url  | italian | english | spanish | -------------------------------------------------- | 1       |  /url  | ciao    | hello   | hola    | -------------------------------------------------- 

2) bind dabatase , properties file? example way?

--------------------------------- | id_link |   url  | description|  -------------------------------- | 1       |  /url  | link1      | ---------------------------------                           |              __ language_it.properties                           |             |   link1= ciao                           |             |                           |-------------|__ language_en.properties                                         |   link1= hello                                         |                                         |__ language_es.properties                                             link1= hola 

i suggest use second approach, store key in database , i18n key in properties.

this allow add more languages in future, without chaning table structure.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -