开发者

should phrases in a multilanguage site be stored in the database or in files?

开发者 https://www.devze.com 2023-04-06 15:38 出处:网络
I\'m developing a website, and want to make multi language support, but I\'m doubting where I should store the phrases.

I'm developing a website, and want to make multi language support, but I'm doubting where I should store the phrases.

Storing them in a database makes it easier to create systems where you crowdsource the translation, in a similar facion facebook and twitter are doing. The disadvantage is that querying a database for phrases can be slow, especially when there are a lot of phrases on a page.

Storin开发者_JAVA技巧g them in a file makes retrieval faster, but makes them harder to manage and maintain.

What are some other pros and cons?


If the phrases need to change often, then store them in a database. If the phrases change infrequently or never, and you are using java, store them in a resource bundle.

If you are worried about load time from a db, you can cache the phrases and periodically update the cache.

0

精彩评论

暂无评论...
验证码 换一张
取 消