Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RCP-44] Supporting Multiple Metadata Locales #67

Open
darnjo opened this issue Dec 5, 2022 Discussed in #59 · 2 comments
Open

[RCP-44] Supporting Multiple Metadata Locales #67

darnjo opened this issue Dec 5, 2022 Discussed in #59 · 2 comments

Comments

@darnjo
Copy link
Member

darnjo commented Dec 5, 2022

Discussed in #59

Option 3: DisplayName Complex Type
It was mentioned on the November 8, 2022 Transport call that perhaps we could use Complex Types to avoid having to repeat data or join on a normalized structure.

See the following comments for more information:

We probably want to change the format a bit from the initial suggestion, for one not have things keyed by locale codes and making the display names into a list so their shape is more normal (regular) and easier to query.

<ComplexType Name="I18nString">
  <Property Name="Locale" Nullable="false" Type="Edm.String" />
  <Property Name="Value" Nullable="false" Type="Edm.String" />
</ComplexType>

<EntityType Name="Field">
  ...
  <Property Name="FieldKey" Type="Edm.String" />
  <Property Name="FieldName" Type="Edm.String" />
  <Property Name="DisplayNames" Type="Collection(I18nString)" />
  ...
</EntityType>

This would allow for querying as well using any and all.

GET /Field?$filter=DisplayNames/any(item: item/Locale in ('en-CA', 'fr-CA'))
{
  "@odata.context": "/Field?$filter=DisplayNames/any(item: item/Locale in ('en-CA', 'fr-CA'))",
  "value": [
    {
      "FieldKey": "f1",
      "FieldName": "ListPrice",
      "DisplayNames": [
        {
          "Locale": "en-CA",
          "Value": "List Price"
        },
        {
          "Locale": "fr-CA",
          "Value": "Liste des Prix"
        }
      ]
    }
  ]
}

This would also work with Lookups:

<ComplexType Name="I18nString">
  <Property Name="Locale" Nullable="false" Type="Edm.String" />
  <Property Name="Value" Nullable="false" Type="Edm.String" />
</ComplexType>

<EntityType Name="Lookup">
  ...
  <Property Name="LookupKey" Type="Edm.String" />
  <Property Name="LookupName" Type="Edm.String" />
  <Property Name="LookupValue" Type="Edm.String" />
  <Property Name="DisplayNames" Type="Collection(I18nString)" />
  ...
</EntityType>
GET /Lookup?$filter=DisplayNames/any(item: item/Locale in ('en-CA', 'fr-CA'))
{
  "@odata.context": "/Lookup?$filter=DisplayNames/any(item: item/Locale in ('en-CA', 'fr-CA'))",
  "value": [
    {
      "LookupKey": "l1",
      "LookupName": "StandardStatus",
      "LookupValue": "Pending",
      "DisplayNames": [
        {
          "Locale": "en-CA",
          "Value": "Pending"
        },
        {
          "Locale": "fr-CA",
          "Value": "En Attente"
        }
      ]
    }
  ]
}

TODOs

  • Lock down the Locale property so that it only accepts ISO Primary Locales, but still supports additional custom locales as per the ISO standard.
  • Consideration of languages other than those supported by UTF-8.
  • Consider adding a field for the Field and Lookup resource that indicates whether a given item has translations available.
@darnjo darnjo added the enhancement New feature or request label Dec 5, 2022
@darnjo darnjo self-assigned this Dec 20, 2022
@darnjo darnjo changed the title Supporting Multiple Metadata Locales RCP-044 - Supporting Multiple Metadata Locales Mar 1, 2023
@psftc
Copy link
Collaborator

psftc commented May 8, 2023

The country code is defined as upper case in the ISO 3166 documentation. We should follow this standard. so en-ca should be en-CA etc.

@darnjo
Copy link
Member Author

darnjo commented May 8, 2023

The country code is defined as upper case in the ISO 3166 documentation. We should follow this standard. so en-ca should be en-CA etc.

Thanks, Paul. The examples have been updated.

@darnjo darnjo changed the title RCP-044 - Supporting Multiple Metadata Locales RCP-044: Supporting Multiple Metadata Locales Jul 3, 2024
@darnjo darnjo changed the title RCP-044: Supporting Multiple Metadata Locales RCP-44: Supporting Multiple Metadata Locales Jul 3, 2024
@darnjo darnjo changed the title RCP-44: Supporting Multiple Metadata Locales [RCP-44] Supporting Multiple Metadata Locales Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants