Skip to content

Commit 704808c

Browse files
authored
Make the localization identical on the DCL auto-completion UI (#206)
Make the localization identical on the DCL auto-completion UI (#206)
1 parent 06e4a3f commit 704808c

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

extension/src/completion/completionLibraryDcl.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ export class CompletionLibraryDcl {
7777

7878
private generateDynamics() : void {
7979
const localDialogStruct = localize("autolispext.commands.dclcompletion.primitive.dialog", "Generates a dialog structure");
80+
const localTile = localize("autolispext.commands.dclcompletion.primitive.Tile", "Tile");
8081
this.dclSnippets.set(SnippetKeys.DIALOG,
81-
this.makeSnippet('dialog', localDialogStruct, 'Tile', `\${1:NAME} : dialog {\n\t$0\n}`, Kinds.TILE)
82+
this.makeSnippet('dialog', localDialogStruct, localTile, `\${1:NAME} : dialog {\n\t$0\n}`, Kinds.TILE)
8283
);
8384

8485
const localPrimitive = localize("autolispext.commands.dclcompletion.primitive", "Primitive");
@@ -113,6 +114,8 @@ export class CompletionLibraryDcl {
113114
}
114115

115116
private generateTiles() : void {
117+
const localTile = localize("autolispext.commands.dclcompletion.primitive.Tile", "Tile");
118+
116119
for (const key of AutoLispExt.WebHelpLibrary.dclTiles.keys()) {
117120
const lowerKey = key.toLowerCase();
118121
if (lowerKey === 'dialog') {
@@ -122,7 +125,7 @@ export class CompletionLibraryDcl {
122125
const def = AutoLispExt.WebHelpLibrary.dclTiles.get(key);
123126
const item = new CompletionItemDcl(def.id);
124127
item.kind = Kinds.TILE;
125-
item.detail = 'Tile';
128+
item.detail = localTile;
126129
item.sortText = `!${lowerKey}`; // The '!' helps elevate suggestions
127130
item.documentation = Annotation.asMarkdown(def);
128131
item.insertText = def.id;
@@ -140,12 +143,14 @@ export class CompletionLibraryDcl {
140143
// TODO: OS Filtering Technical debt
141144
// After the Lisp AutoComplete gets updated, then we can turn on the new setting for both document types.
142145

146+
const localAttr = localize("autolispext.commands.dclcompletion.primitive.Attribute", "Attribute");
147+
143148
for (const key of AutoLispExt.WebHelpLibrary.dclAttributes.keys()) {
144149
const def = AutoLispExt.WebHelpLibrary.dclAttributes.get(key);
145150
const lowerKey = key.toLowerCase();
146151
const item = new CompletionItemDcl(def.id);
147152
item.kind = Kinds.ATTRIBUTE;
148-
item.detail = 'Attribute';
153+
item.detail = localAttr;
149154
item.sortText = `!!${lowerKey}`; // The '!!' helps elevate Attribute suggestions above Tile suggestions
150155
item.documentation = Annotation.asMarkdown(def);
151156
item.insertText = def.id;
@@ -154,6 +159,8 @@ export class CompletionLibraryDcl {
154159
}
155160

156161
private generateEnums() : void {
162+
const localEnum = localize("autolispext.commands.dclcompletion.primitive.Enum", "Enum");
163+
157164
for (const key of AutoLispExt.WebHelpLibrary.dclAttributes.keys()) {
158165
const def = AutoLispExt.WebHelpLibrary.dclAttributes.get(key);
159166
const lowerKey = key.toLowerCase();
@@ -173,7 +180,7 @@ export class CompletionLibraryDcl {
173180
def.valueType.enums.forEach(name => {
174181
const item = new CompletionItemDcl(name);
175182
item.kind = Kinds.ENUM;
176-
item.detail = 'Enum';
183+
item.detail = localEnum;
177184
item.sortText = name;
178185
item.insertText = name;
179186
types.push(item);

extension/src/completion/completionProviderDcl.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import {CompletionItemDcl} from "./completionItemDcl";
77
import {AutoLispExt} from "../context";
88
import {CompletionLibraryDcl, SnippetKeys} from "./completionLibraryDcl";
99
import {Kinds} from './completionItemDcl';
10+
import * as nls from 'vscode-nls';
11+
12+
const localize = nls.loadMessageBundle();
13+
1014

1115
// This file is responsible for determining what could potentially be suggested give the current context
1216

@@ -105,10 +109,12 @@ function getApplicableAttributes(tile: DclTile, pos: Position) : Array<string> {
105109
function stringProcessing(atom: IDclFragment, directParent: IDclContainer, pos: Position, context: CompletionContext): Array<CompletionItemDcl> {
106110
const index = directParent.atoms.indexOf(atom);
107111
if (directParent.atoms[index + 1]?.symbol !== ';' && pos.character === atom.range.end.character - 1) {
112+
const localPrimitive = localize("autolispext.commands.dclcompletion.provider.Primitive", "Primitive");
113+
const localClosesStr = localize("autolispext.commands.dclcompletion.provider.ClosesString", "Closes the string");
108114
const result = new CompletionItemDcl(`${atom.symbol};`);
109115
result.insertText = `${atom.symbol};`;
110-
result.detail = 'Primitive';
111-
result.documentation = 'Closes the string';
116+
result.detail = localPrimitive;
117+
result.documentation = localClosesStr;
112118
result.range = atom.range;
113119
result.kind = Kinds.PRIMITIVE;
114120
return [result];

i18n/enu/out/completion/completionLibraryDcl.i18n.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
"autolispext.commands.dclcompletion.primitive.dialog": "Generates a dialog structure",
44
"autolispext.commands.dclcompletion.primitive.structure": "structural primitive",
55
"autolispext.commands.dclcompletion.primitive.string": "string structure",
6-
"autolispext.commands.dclcompletion.primitive.boolean": "boolean structure"
6+
"autolispext.commands.dclcompletion.primitive.boolean": "boolean structure",
7+
"autolispext.commands.dclcompletion.primitive.Enum": "Enum",
8+
"autolispext.commands.dclcompletion.primitive.Attribute": "Attribute",
9+
"autolispext.commands.dclcompletion.primitive.Tile": "Tile"
710
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"autolispext.commands.dclcompletion.provider.Primitive": "Primitive",
3+
"autolispext.commands.dclcompletion.provider.ClosesString": "Closes the string"
4+
}

0 commit comments

Comments
 (0)