【Microsoft Lists】サイトの表示言語にあわせた書式設定(@UIlcid)

リストの書式設定で @UIlcid トークン が利用できるようになり、 サイトの表示言語にあわせた書式設定 ができるようになりました。

@UIlcid トークンで取得される値

@UIlcid トークンを利用すると、現在サイト表示に利用されている言語の LCID 値 が取得されます。

@UIlcid トークンを利用した書式設定のサンプル

@UIlcid トークンを利用し、下図のようなサイト表示言語にあわせて Microsoft Docs への URL を変更するリンク列の書式設定を作成してみました。

書式設定のコードは、次の通りです。

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "a",
      "txtContent": "@currentField.desc",
      "style": {
        "text-decoration": "none"
      },
      "attributes": {
        "href": "=if(@UIlcid==1041,replace(@currentField,'en-us','ja-jp'),@currentField))",
        "target": "_blank",
        "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
      }
    }
  ]
}

関連リンク

support.microsoft.com

support.microsoft.com

support.microsoft.com