Skip to content

Commit

Permalink
feat: Support for ToolTips on table fields #460 (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwikman authored Jan 27, 2025
1 parent 4e89daf commit 5b2a32b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 14 deletions.
1 change: 1 addition & 0 deletions extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
- Added support for namespaces in symbols.
- Added support for System Actions on pages of type PromptDialog.
- Added support for namespaces in AL objects.
- Added support for ToolTips on table fields.
- Added a new setting, `NAB.AutoAcceptSuggestions`. If enabled, the `NAB: Refresh XLF files from g.xlf` function will automatically accept the first suggestion, if any. This feature only works if `UseExternalTranslationTool` is disabled. Disabled by default. Thanks to [dirkmass](https://github.com/dirkmass) for suggesting this in [issue 470](https://github.com/jwikman/nab-al-tools/issues/470).
- Added a new setting, `NAB.SetExactMatchToState`. Specifies that when working with the target state attributes (`NAB.UseExternalTranslationTool: true`) and this is set to a target state value, when executing the `NAB: Refresh XLF files from g.xlf` function and an exact match is found, the target state will be set to the configured state and the state-qualifier will be set to `exact-match`.
- Added a new setting, `NAB.ClearTargetWhenSourceHasChanged`. If enabled, the target will be set to a blank value if the source has been changed when the `NAB: Refresh XLF files from g.xlf` function is being executed. The target state will be set to `needs-translation`. This is only applicable when `NAB.UseExternalTranslationTool` is enabled.
Expand Down
17 changes: 17 additions & 0 deletions extension/src/ALObject/ALPageField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ export class ALPageField extends ALPageControl {
const sourceObject = this.getObject().getSourceObject();
return sourceObject && sourceObject.isSystemObject ? field.name : "";
}
public get toolTip(): string {
const toolTip = super.toolTip;
if (toolTip !== "") {
return toolTip;
}

// Check table for ToolTip
const field = this.getSourceTableField();
if (!field) {
return "";
}
return field.toolTip;
}

public set toolTip(value: string) {
super.toolTip = value;
}

public get readOnly(): boolean {
if (!this.getProperty(ALPropertyType.editable, true)) {
Expand Down
15 changes: 5 additions & 10 deletions test-app/Xliff-test/Translations/Al.g.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Table NAB ToolTip - Field Field 1 - Property Caption</note>
</trans-unit>
<trans-unit id="Table 2794708188 - Field 3814457204 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Specifies the value of the Field 2 field</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Table NAB ToolTip - Field Field 2 - Property ToolTip</note>
</trans-unit>
<trans-unit id="Table 2794708188 - Field 3814457204 - Property 2879900210" size-unit="char" translate="yes" xml:space="preserve">
<source>Field 2</source>
<note from="Developer" annotates="general" priority="2"></note>
Expand Down Expand Up @@ -543,11 +548,6 @@
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB ToolTip Part 2 - Control Field 1 - Property ToolTip</note>
</trans-unit>
<trans-unit id="Page 3265081943 - Control 3814457204 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Specifies the value of the Field 2 field</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB ToolTip Part 2 - Control Field 2 - Property ToolTip</note>
</trans-unit>
<trans-unit id="Page 3265081943 - Control 3176760587 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Specifies the value of the Field 3 field</source>
<note from="Developer" annotates="general" priority="2"></note>
Expand All @@ -568,11 +568,6 @@
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB ToolTips - Control Field 1 - Property ToolTip</note>
</trans-unit>
<trans-unit id="Page 1462529885 - Control 3814457204 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Specifies the value of the Field 2 field</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB ToolTips - Control Field 2 - Property ToolTip</note>
</trans-unit>
<trans-unit id="Page 1462529885 - Control 3176760587 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Specifies the value of the Field 3</source>
<note from="Developer" annotates="general" priority="2"></note>
Expand Down
4 changes: 2 additions & 2 deletions test-app/Xliff-test/docs/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"generated-date": "2024-12-06",
"generator": "NAB AL Tools v1.33.411302249",
"generated-date": "2025-01-27",
"generator": "NAB AL Tools v1.33.412062251",
"app-id": "ed43c16b-7d86-4b49-ab59-d1660c4ef64f",
"app-name": "Al",
"app-publisher": "Default publisher",
Expand Down
1 change: 1 addition & 0 deletions test-app/Xliff-test/src/ToolTip/ToolTip.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ table 50001 "NAB ToolTip"
{
Caption = 'Field 2';
DataClassification = CustomerContent;
ToolTip = 'Specifies the value of the Field 2 field';
}
field(12; "Field 3"; Decimal)
{
Expand Down
1 change: 0 additions & 1 deletion test-app/Xliff-test/src/ToolTip/ToolTipPart2.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ page 50003 "NAB ToolTip Part 2"
field("Field 2"; Rec."Field 2")
{
ApplicationArea = All;
ToolTip = 'Specifies the value of the Field 2 field';
}
field("Field 3"; Rec."Field 3")
{
Expand Down
1 change: 0 additions & 1 deletion test-app/Xliff-test/src/ToolTip/ToolTips.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ page 50001 "NAB ToolTips"
field("Field 2"; Rec."Field 2")
{
ApplicationArea = All;
ToolTip = 'Specifies the value of the Field 2 field';
}
field("Field 3"; Rec."Field 3")
{
Expand Down

0 comments on commit 5b2a32b

Please sign in to comment.