LocalizedAttributeService
using Skipcheck.Tm1.Client.Services; Translated attribute values: an AttributeOwner's LocalizedAttributes,
one per locale, keyed by locale ID (fr, de-CH). The values are in
Attributes: Caption, and every other attribute in its
dynamicProperties (set with AttributesPatch.Builder.Property).
Only attributes the owner's kind has can be translated (see AttributeService):
Caption too, once it's defined. A member's translations are its element's, and
read only: write them through AttributeOwner.Element.
TM1 (11.8) creates a locale's translations once and reads them, and that's all: it
supports no PATCH or DELETE on them and refuses to create a locale twice. Changing or
removing translations goes through the }Localized…Attributes control
cubes, as cell writes.
Translate an element's attribute into French:
// The French for an element's Long Name, an attribute its hierarchy has. A
// locale's translations are created once: TM1 can't change them here.
return await tm1.LocalizedAttributes.CreateAsync(
AttributeOwner.Element("Region", "Region", "North"),
LocalizedAttributesPatch.Builder().LocaleID("fr").Attributes(AttributesPatch.Builder().Property("Long Name", "Région Nord").Build()).Build()
);
Read the translation back:
// Attributes other than Caption come back in DynamicProperties
var french = await tm1.LocalizedAttributes.GetAsync(AttributeOwner.Element("Region", "Region", "North"), "fr");
return french.Attributes?.DynamicProperties is { } values && values.TryGetValue("Long Name", out var name) ? name.GetString() : null;
Members
LocalizedAttributeService constructor | A service that sends its requests through session. |
ListAsync | The owner's translations, one per locale, streamed. |
GetAsync | The translations for the locale, or a Tm1NotFoundException if there are none. |
CreateAsync | Adds translations for a locale, its LocaleID and the translated Attributes; returns them as created. |
LocalizedAttributeService
constructorLocalizedAttributeService(Tm1Session session)A service that sends its requests through session.
ListAsync
IAsyncEnumerable<LocalizedAttributes> ListAsync(AttributeOwner owner, ODataQuery? query = null, CancellationToken cancellationToken = default)GET …/LocalizedAttributes: the owner's translations, one per locale, streamed.
TM1 REST Navigation Dimension/LocalizedAttributes Navigation Hierarchy/LocalizedAttributes Navigation Element/LocalizedAttributes Navigation Member/LocalizedAttributes Navigation Subset/LocalizedAttributes Navigation Cube/LocalizedAttributes Navigation View/LocalizedAttributes Navigation Process/LocalizedAttributes Navigation Chore/LocalizedAttributes
GetAsync
Task<LocalizedAttributes> GetAsync(AttributeOwner owner, string locale, ODataQuery? query = null, CancellationToken cancellationToken = default)GET …/LocalizedAttributes('locale'): the translations for the locale, or a
Tm1NotFoundException if there are none.
TM1 REST Navigation Dimension/LocalizedAttributes Navigation Hierarchy/LocalizedAttributes Navigation Element/LocalizedAttributes Navigation Member/LocalizedAttributes Navigation Subset/LocalizedAttributes Navigation Cube/LocalizedAttributes Navigation View/LocalizedAttributes Navigation Process/LocalizedAttributes Navigation Chore/LocalizedAttributes
CreateAsync
Task<LocalizedAttributes> CreateAsync(AttributeOwner owner, LocalizedAttributesPatch translations, CancellationToken cancellationToken = default)POST …/LocalizedAttributes: adds translations for a locale, its LocaleID and
the translated Attributes; returns them as created.
TM1 REST Navigation Dimension/LocalizedAttributes Navigation Hierarchy/LocalizedAttributes Navigation Element/LocalizedAttributes Navigation Member/LocalizedAttributes Navigation Subset/LocalizedAttributes Navigation Cube/LocalizedAttributes Navigation View/LocalizedAttributes Navigation Process/LocalizedAttributes Navigation Chore/LocalizedAttributes