Table of Contents

KVSKBATextConstantLanguageLib

Procedures

GetTextConstant(Code[10], Integer) : Text[1024]

Summary: Returns the text constant for the given language code and text constant number.

procedure GetTextConstant(LanguageCode: Code[10]; TextConstantNo: Integer): Text[1024]

Parameters:

  • LanguageCode: The language code for which the text constant is requested.
  • TextConstantNo: The number of the text constant to retrieve.

Returns: The text constant in the specified language.

Example: var TextConstant: Text[1024]; begin TextConstant := GetTextConstant('ENU', 1); // Returns 'TOTAL ' for English (United States) TextConstant := GetTextConstant('FR', 5940); // Returns 'Service Contract: %1' for French (France) end;

Remarks: This function retrieves the text constant based on the provided language code and text constant number. If the language code is valid, it sets the current report language to that language. If the text constant number is recognized, it returns the corresponding text constant. If the text constant number is not recognized, it raises an error indicating that the text constant has not been defined.

Events

OnGetTextConstantOnCaseElseTextConstantNo(Integer, Text[1024], Boolean) :

Summary: Event raised when the text constant number provided to the GetTextConstant function does not match any of the predefined cases. This allows subscribers to provide translations for additional text constants without modifying the original function.

[IntegrationEvent(false, false)]
local procedure OnGetTextConstantOnCaseElseTextConstantNo(TextConstantNo: Integer; var TranslatedText: Text[1024]; var IsHandled: Boolean): 

Parameters:

  • TextConstantNo: The number of the text constant that was not recognized.
  • TranslatedText: The translated text for the unrecognized text constant. Subscribers can set this parameter to provide the appropriate translation.
  • IsHandled: Indicates whether the event has been handled by a subscriber. Subscribers should set this parameter to true if they have provided a translation for the unrecognized text constant, which will prevent the original function from raising an error.