-
Notifications
You must be signed in to change notification settings - Fork 287
[BC Idea]: Add GetTranslations Method to Translation Codeunit #5443
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
base: releases/27.x
Are you sure you want to change the base?
[BC Idea]: Add GetTranslations Method to Translation Codeunit #5443
Conversation
|
Issue #5434 is not valid. Please make sure you link an issue that exists, is open and is approved. |
|
pri-kise
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add some tests:
[Test]
[Scope('OnPrem')]
procedure GetTranslationsForOneFieldFromRecord()
var
TranslationTestTable: Record "Translation Test Table";
TranslationBuffer: Record "Translation Buffer"
DestRecRef: RecordRef;
SourceRecRef: RecordRef;
begin
// [SCENARIO] Translation must retrieved correctly for one field
Initialize();
PermissionsMock.Set(TranslationEditRoleTok);
// [GIVEN] Create a record in TableA and set a translation for the fields FieldA and FieldB
CreateRecord(TranslationTestTable);
Translation.Set(TranslationTestTable, TranslationTestTable.FieldNo(TextField), Text1Txt);
Translation.Set(TranslationTestTable, TranslationTestTable.FieldNo(SecondTextField), Text2Txt);
// [WHEN] Translations are retrieved
Translation.GetTranslations(SourceRecRef, TranslationTestTable.FieldNo(TextField), TranslationBuffer);
// [THEN] Verify Translations
//TODO:
end; [Test]
[Scope('OnPrem')]
procedure GetTranslationsForAllFieldsFromRecord()
var
TranslationTestTable: Record "Translation Test Table";
TranslationBuffer: Record "Translation Buffer"
DestRecRef: RecordRef;
SourceRecRef: RecordRef;
begin
// [SCENARIO] Translation must retrieved correctly for all fields when FieldId is 0
Initialize();
PermissionsMock.Set(TranslationEditRoleTok);
// [GIVEN] Create a record in TableA and set a translation for the fields FieldA and FieldB
CreateRecord(TranslationTestTable);
Translation.Set(TranslationTestTable, TranslationTestTable.FieldNo(TextField), Text1Txt);
Translation.Set(TranslationTestTable, TranslationTestTable.FieldNo(SecondTextField), Text2Txt);
// [WHEN] Translations are retrieved
Translation.GetTranslations(SourceRecRef, 0, TranslationBuffer);
// [THEN] Verify Translations
//TODO:
end;
src/System Application/App/Translation/src/Translation.Codeunit.al
Outdated
Show resolved
Hide resolved
d4a92bc to
b240658
Compare
c671d47 to
24ea1c8
Compare
|
@JesperSchulz Apologies for the inconvenience, but could we please expedite this? |
…nslation Buffer table Add a new procedure GetTranslations to the Translation Implementation codeunit for retrieving translations based on record variants and field IDs. Introduce a new Translation Buffer table to store translation data temporarily, including fields for Language ID, System ID, Table ID, Field ID, and Value. This enhances the translation functionality by allowing retrieval of translations for specific fields or all fields when FieldId is 0.
24ea1c8 to
489a226
Compare
Summary
This pull request extends the System Application Translation module with a new public API for programmatic retrieval of translation data, addressing the requirements of partners and ISVs for custom translation workflows and data integration scenarios.
Current Gap: The existing Translation module API lacks bulk retrieval capabilities needed for:
Technical Approach
Introduces a read-only query API following established System Application patterns, returning results via a temporary buffer table to ensure no database impact and maintain performance standards.
API Design
Public Procedure:
GetTranslationsLocation:
codeunit 3711 "Translation"(System Application)Signature:
Parameters:
Returns:
Boolean- True if translations found, False otherwiseDesign Rationale:
Translation.Set()andTranslation.Get()APIsWork Item(s)
Fixes #5434