incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shorin <>
Subject Localize documents data
Date Fri, 24 Feb 2012 06:04:48 GMT

While English language is quite common wide the rest real world is not
so perfect(: I'd like to talk about how to store multi language data
within single document (or may in different ones?). How would you
solve this task, when you need to keep information in English, French,
Czech and other languages for document values and keys?
I've found next ways to solve this problem:

1. by using gettext on CouchDB side. po2json looks promise[1]

2. by storing locale information within separate document field (lets
call it `.locale`) that contains json-patches[2] grouped by locale id.
Example structure:
  ".locale": {
    "fr_FR": [...],
    "ru_RU": [...]
When you need to return translated document to specific locale, you
just apply set of patches to document.

3. by storing translation within target fields. Example:
  "beast": {
    "en_US": {
      "key": "beast",
      "value": "monkey"
    "ru_RU": {
      "key": "зверь",
      "value": "обезьяна"
    "es_ES": {
      "key": "bestia",
      "value": "mono"

4. just store additional document per language: disk space is cheap
(ok, not so as one year ago) and do not create more problems for your

Currently, my opinion lies between p.1 and p.2, but what's the right
option, the best practice to be able translate document data for
various languages?


[2] http://


View raw message