Codeunit Translation
Exposes function\alitys to add and retrieve translated texts for table fields.
Properties
| Name | Value |
|---|---|
| Access | Public |
Methods
Any
Checks if there any translations present at all.
procedure Any(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
True if there is at least one translation; false, otherwise. |
Get
Gets the value of a field in the global language for the record.
procedure Get(RecVariant: Variant, FieldId: Integer): Text
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
The record to get the translated value for. |
| FieldId | Integer |
The ID of the field for which the translation is stored. |
Returns
| Type | Description |
|---|---|
| Text |
The translated value. |
Examples
To get the value of the description field for an item record, call GetValue(Item, Item.FIELDNO(Description)).
Remarks
If a translated record for the global language cannot be found it finds the Windows language translation. If a Windows language translation cannot be found, return an empty string.
Get
Gets the value of a field in the language that is specified for the record.
procedure Get(RecVariant: Variant, FieldId: Integer, LanguageId: Integer): Text
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
The record to get the translated value for. |
| FieldId | Integer |
The ID of the field to store the translation for. |
| LanguageId | Integer |
The ID of the language in which to get the field value. |
Returns
| Type | Description |
|---|---|
| Text |
The translated value. |
Examples
To get the value of the Description field for an item record in Danish, call GetValue(Item, Item.FIELDNO(Description), 1030).
Set
Sets the value of a field to the global language for the record.
procedure Set(RecVariant: Variant, FieldId: Integer, Value: Text[2048])
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
The record to store the translated value for. |
| FieldId | Integer |
The ID of the field to store the translation for. |
| Value | Text[2048] |
The translated value to set. |
Set
Sets the value of a field to the language specified for the record.
procedure Set(RecVariant: Variant, FieldId: Integer, LanguageId: Integer, Value: Text[2048])
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
The record to store the translated value for. |
| FieldId | Integer |
The ID of the field to store the translation for. |
| LanguageId | Integer |
The language id to set the value for. |
| Value | Text[2048] |
The translated value to set. |
Delete
Deletes all translations for a persisted (non temporary) record.
procedure Delete(RecVariant: Variant)
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
The record for which the translations will be deleted. |
Delete
Deletes the translation for a field on a persisted (non temporary) record.
procedure Delete(RecVariant: Variant, FieldId: Integer)
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
The record with a field for which the translation will be deleted. |
| FieldId | Integer |
Id of the field for which the translation will be deleted. |
Delete
Deletes all the translation for a table ID.
procedure Delete(TableID: Integer)
Parameters
| Name | Type | Description |
|---|---|---|
| TableID | Integer |
The table that the translations will be deleted for. |
Copy
Copies the translation for a field from one record to another record on a persisted (non-temporary) record.
procedure Copy(FromRecVariant: Variant, ToRecVariant: Variant)
Parameters
| Name | Type | Description |
|---|---|---|
| FromRecVariant | Variant |
The record from which the translations are copied. |
| ToRecVariant | Variant |
The record to which the translations are copied. |
Copy
Copies the translation for a field from one record to another record on a persisted (non-temporary) record.
procedure Copy(FromRecVariant: Variant, ToRecVariant: Variant, FieldId: Integer)
Parameters
| Name | Type | Description |
|---|---|---|
| FromRecVariant | Variant |
The record from which the translations are copied. |
| ToRecVariant | Variant |
The record to which the translations are copied. |
| FieldId | Integer |
Id of the field for which the translation will be copied. |
Copy
Copies the translation from one record's field to another record's field on a persisted (non-temporary) record.
procedure Copy(FromRecVariant: Variant, FromFieldId: Integer, ToRecVariant: Variant, ToFieldId: Integer)
Parameters
| Name | Type | Description |
|---|---|---|
| FromRecVariant | Variant |
The record from which the translations are copied. |
| FromFieldId | Integer |
The id of the field from which the translations are copied. |
| ToRecVariant | Variant |
The record to which the translations are copied. |
| ToFieldId | Integer |
The id of the field to which the translations are copied. |
Show
Shows all language translations that are available for a field in a new page.
procedure Show(RecVariant: Variant, FieldId: Integer)
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
The record to get the translated value for. |
| FieldId | Integer |
The ID of the field to get translations for. |
Show
Shows all language translations that are available for a field in a new page.
procedure Show(RecVariant: Variant, FieldId: Integer, CheckFieldLength: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
The record to get the translated value for. |
| FieldId | Integer |
The ID of the field to get translations for. |
| CheckFieldLength | Boolean |
If this value is true, then it's checked that the translation isn't longer than the field length. |
ShowForAllRecords
Shows all language translations available for a given field for all the records in that table in a new page.
procedure ShowForAllRecords(TableId: Integer, FieldId: Integer)
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID to get translations for. |
| FieldId | Integer |
The ID of the field to get translations for. |
GetTranslations
Gets all available translations for a record into a temporary buffer. If FieldId is 0, it retrieves translations for all fields.
procedure GetTranslations(RecVariant: Variant, FieldId: Integer, var TranslationBuffer: Record "Translation Buffer" temporary): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RecVariant | Variant |
Source record variant |
| FieldId | Integer |
Field ID to get translations for. Use 0 to retrieve translations for all fields. |
| TranslationBuffer | Table System.Globalization."Translation Buffer" |
Output: Temporary buffer with translations |
Returns
| Type | Description |
|---|---|
| Boolean |
True if translations were found |