Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3C49B9B91 for ; Fri, 24 Feb 2012 06:05:18 +0000 (UTC) Received: (qmail 33343 invoked by uid 500); 24 Feb 2012 06:05:16 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 33176 invoked by uid 500); 24 Feb 2012 06:05:15 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 33163 invoked by uid 99); 24 Feb 2012 06:05:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2012 06:05:15 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of kxepal@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2012 06:05:08 +0000 Received: by qcsd15 with SMTP id d15so341317qcs.11 for ; Thu, 23 Feb 2012 22:04:48 -0800 (PST) Received-SPF: pass (google.com: domain of kxepal@gmail.com designates 10.229.102.148 as permitted sender) client-ip=10.229.102.148; Authentication-Results: mr.google.com; spf=pass (google.com: domain of kxepal@gmail.com designates 10.229.102.148 as permitted sender) smtp.mail=kxepal@gmail.com; dkim=pass header.i=kxepal@gmail.com Received: from mr.google.com ([10.229.102.148]) by 10.229.102.148 with SMTP id g20mr780603qco.124.1330063488186 (num_hops = 1); Thu, 23 Feb 2012 22:04:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=Goshb3Jdv7ChgW1rqhtNwyAU1UCBte441ftrlgFGQWQ=; b=J8eEbcOZ6+W2GYZzqke+WQK+K/Pd/VpXEta6GroLhBuA4wqoDQzUDe+NBRv8h85kxr T0VEEljraoTFq5KO2lQJsAFVOACdfG/sd1xqLCsQMRw4mvj7M1Bgrh8Ds2naxo7G/6t2 y4ye1G2tjyFdkE7bdRrGzdvyr5B1BgxHqyLVY= MIME-Version: 1.0 Received: by 10.229.102.148 with SMTP id g20mr645664qco.124.1330063488077; Thu, 23 Feb 2012 22:04:48 -0800 (PST) Received: by 10.224.196.193 with HTTP; Thu, 23 Feb 2012 22:04:48 -0800 (PST) Date: Fri, 24 Feb 2012 09:04:48 +0300 Message-ID: Subject: Localize documents data From: Alexander Shorin To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi! 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": "=D0=B7=D0=B2=D0=B5=D1=80=D1=8C", "value": "=D0=BE=D0=B1=D0=B5=D0=B7=D1=8C=D1=8F=D0=BD=D0=B0" }, "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 head!(: 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? Thanks. [1] http://jsgettext.berlios.de/ [2] http://http://tools.ietf.org/html/draft-pbryan-json-patch -- ,,,^..^,,,