[Jmap] JSContact: how to localize content

Robert Stepanek <rsto@fastmailteam.com> Wed, 21 July 2021 12:13 UTC

Return-Path: <rsto@fastmailteam.com>
X-Original-To: jmap@ietfa.amsl.com
Delivered-To: jmap@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ED7383A138B for <jmap@ietfa.amsl.com>; Wed, 21 Jul 2021 05:13:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.087
X-Spam-Level:
X-Spam-Status: No, score=-2.087 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=fastmailteam.com header.b=w1HPpefy; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=TBdq8hia
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fzQHJWoxAe5m for <jmap@ietfa.amsl.com>; Wed, 21 Jul 2021 05:13:06 -0700 (PDT)
Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F2FC03A1388 for <jmap@ietf.org>; Wed, 21 Jul 2021 05:13:05 -0700 (PDT)
Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 2D534320097C for <jmap@ietf.org>; Wed, 21 Jul 2021 08:13:00 -0400 (EDT)
Received: from imap43 ([10.202.2.93]) by compute4.internal (MEProxy); Wed, 21 Jul 2021 08:13:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= fastmailteam.com; h=mime-version:message-id:date:from:to:subject :content-type; s=fm3; bh=M043kJvilz8eWAyy4fNv+jNUNt8W3tKKHT3aldm GrgE=; b=w1HPpefyi6wdJ6eGqVMRak+mYAjQr1XMl95fzwSwVuTz/9ofzziQwso Q+llCV7C/muKZJimtzp/9DNY2CVp9w78VkLrbC034yAPmE1UdRQ7kh8KP6r4DKhU 1LlniAlFx9p8kCXvRL/5kExSziRIC2dES07ibfsQ+r0C0so0CgIQ/5bLyLlIhyan JUzbWplIzTemI5wQZpHMQp53ZV6obyTUdvNJXxfATM/n7VJhURyWcae/goX9OUPf 74pt9W6YmEa4z4VEZlwOxM2bLqHwuI2aqL9BEgx/O3mZsV5BRncqheBEJYV8mEKm ThNGSQIGRFIgwQc7DAlL/jIjvMdxkig==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=M043kJvilz8eWAyy4fNv+jNUNt8W3 tKKHT3aldmGrgE=; b=TBdq8hiaGMvC/OYckynE8RsjH4nT1pJFEseUgdE/70z8F 1Fq2p6Ns966sZa0XaeoUCAzfhtoH1AtSbKMj/SagrZxTyJp5gRpc4t2WMCHdF6cp 9fQK2Hk2XQl6OuUhapTzwPTeO+OGKZklBvRkP60f7+SdF6GEWJjLU5NrE05KpCQz x48DnsNJJVN4Pk2iVqZpmJKdg7dWuoBqbIjgwX+ZmurOBrJdnA5d7zVvvJyAajct pXjUHIEaURNHEbeBGJ/trFzraTgC6GltvwPDfh79qcdm/LZ6BnnWdGioFqz95Mvc 2g9Vr8dzxxtYoSHkJAFKiIHWKtLhmBxgMl6+6Wfkg==
X-ME-Sender: <xms:Sw_4YM0Y2fo7JAyaA4Xf3kMlvSXu0wVQzCjK9zjdeMpm9PwcboeY_A> <xme:Sw_4YHHZqcXG9833KoxOl2oZ8cPKXn69_3OMP8RO_XXYNOn0Fpo68LnFWS1XZcWXk 4RDcsRlUioQ-A>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfeeggdegjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkfffhvffutgesrgdtreerre erjeenucfhrhhomhepfdftohgsvghrthcuufhtvghprghnvghkfdcuoehrshhtohesfhgr shhtmhgrihhlthgvrghmrdgtohhmqeenucggtffrrghtthgvrhhnpeelheetledvvefhte efgfeujeegffeutdfgheefiefhhfevueevteefueevtddtgeenucffohhmrghinhepihgv thhfrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheprhhsthhosehfrghsthhmrghilhhtvggrmhdrtghomh
X-ME-Proxy: <xmx:Sw_4YE5zOSx5GNBJMf4OnnNy1TJ14XynVesEeqZyoDvAlqj9Zd3Y-Q> <xmx:Sw_4YF2Y2aaKbFhRWFkfwpkxni1uEP1CuN9sKzrq-hk_6uR2BB6zOw> <xmx:Sw_4YPExieEL_ljnv7wccMTvQ_dyenmd5fU10h93IDTH06whefUzVA> <xmx:Sw_4YDTwVKHoLGcuG69E8CGL9Q0ro7cuMQUq8pzWxlNRW5KRbbtmaA>
Received: by mailuser.nyi.internal (Postfix, from userid 501) id 80767AC0E8F; Wed, 21 Jul 2021 08:12:59 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.5.0-alpha0-981-g92194709fa-fm-ubox-20210721.002-g92194709
Mime-Version: 1.0
Message-Id: <b6cc81ae-1cdd-476c-925c-a2534e0d7e9b@www.fastmail.com>
Date: Wed, 21 Jul 2021 14:12:38 +0200
From: "Robert Stepanek" <rsto@fastmailteam.com>
To: jmap@ietf.org
Content-Type: multipart/alternative; boundary=932bd6f2b795465db3ded57eaf88acac
Archived-At: <https://mailarchive.ietf.org/arch/msg/jmap/mYSjpePDjPAPBkh3KB06mJ9DQvw>
Subject: [Jmap] JSContact: how to localize content
X-BeenThere: jmap@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: JSON Message Access Protocol <jmap.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jmap>, <mailto:jmap-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jmap/>
List-Post: <mailto:jmap@ietf.org>
List-Help: <mailto:jmap-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jmap>, <mailto:jmap-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 21 Jul 2021 12:13:12 -0000

At the joint CALEXT/JMAP interim meeting <https://datatracker.ietf.org/doc/minutes-interim-2021-jmap-01-202104150300/> in April we discussed options how localize JSContact values. This can be useful to provide names and addresses in multiple languages within the same contact. In VCARD this is achieved with the LANG parameter.

We would now like to find consensus how to achieve this in JSContact.

*Current approach*
The current scheme in the spec defines a LocalizedString object for fields that can be localized. A LocalizedString has a value and optional localized variants of this value:
"addresses": {
  "addr1": {
    "city": {
      "value": "Tokyo",
      "localizations": {
        "jp": "東京"
      }
    }
  }
}
The idea is to keep values and their localizations close. It is built on the assumption that the majority of values will have localized variants.

*Proposed approach*
Multiple participants in the interim meeting vouched for replacing the current approach with the one defined in section 4.6.1 <https://datatracker.ietf.org/doc/html/rfc8984#section-4.6.1> of the JSCalendar RFC. That is, the "localizations" property is a JSON object where the keys are language tags, and the values are patch objects which overwrite one or multiple properties within a contact.

A main benefit  of this is to reuse for the same approach in both JMAP calendars and contacts. It treats localized content as the exception, not the norm, and the data types should reflect this. Any property value can be localized (except if the spec explicitly forbids it). In contrast, only values of LocalizedString can be localized in the current approach.

This an example how to localize a single address field:
"addresses": {
  "addr1": {
    "city": "Tokyo",
   }
},
"localizations": {
  "jp": {
    "addresses/addr1/city":"東京"
  }
}
To fully localize an address, one would write:
"localizations": {
  "jp": {
    "addresses/addr1": {
      "city": "東京"
    }
  }
}


*Finding consensus*
Mario and I would now like to know which approach you prefer, or any other you would like to propose. Our goal is to reach clear consensus. We look forward to your feedback.

Thanks,
Robert