Gilbert
Gilbert

Reputation: 921

How do I Store / Access Translations Efficiently?

I am trying to translate some of the phrases of my website into various languages. so, in my database, I have a table with rows of

ID//text//dest_language//text_in_dest_language

At the moment, I retreive each translation one by one:

get text_in_dest_language where text="Hello World" and dest_languge="zh"

This results in 40-50 db calls per page, which, on the app engine, is rather slow.

What can I do to mitigate this slowdown?

Upvotes: 0

Views: 162

Answers (1)

Cade Roux
Cade Roux

Reputation: 89661

  1. Cache them in the application server layer (in ASP.NET, you can store it in the Application object or in the Session object).

or

  1. Make a single DB call to get a single recordset of all the phrases used in the page.

Upvotes: 1

Related Questions