Skip to content

Commit

Permalink
3.1.0: include xlf conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Fenster committed Mar 27, 2018
1 parent d219fc9 commit 1ffaed8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ The third part of AL Runner gives you a quick and easy way to get started with t

## Features

Provides six commands:
Provides eight commands:
- "ALRunner: Run selection" or Alt+R which runs the object in the currently selected line, if that is a page or report object
- "ALRunner: Run object on first line" or Shift+Alt+R which runs the object on the first line of the current file, if that is a page or report object
- "ALRunner: Publish and run selection" or Alt+P which publishes your extension and runs the object in the currently selected line, if that is a page object. Note: This changes your launch config
- "ALRunner: Publish and run object on first line" or Shift+Alt+P which publishes your extension and runs the object on the first line of the current file, if that is a page object. Note: This changes your launch config
- "ALRunner: Generate objects by parsing a JSON object from a URL" asks you for a URL, which should return a JSON file (authentication currently not supported) and then for the name of the entity represented by that JSON file. It then generates a table structured like the JSON file, a page showing that table and a codeunit with a function to refresh that data
- "ALRunner: Generate objects by parsing a JSON object in the current selection" does the same as the previous command but uses the currently selected text as data for parsing. This als asks you for a URL, which is only used for generating the AL code do download data and then for the name of the entity represented by that JSON file. With this command you code download a JSON object using authentication and then put the result into VS Code, select the relevant part and let generation run. For nested objects you could do the same but would need to handle linking parent and child objects
- "ALRunner: Convert generated xlf to real one" takes a generated projectname.g.xlf file and copies the source tags into target tags so that the file becomes a valid xlf file. Keep in mind that this is really only the starting point for translating your extension
- "ALRunner: Go API on Azure!" asks you to log in to your Azure account and select the subscription and resource group you want to use. It then uses an ARM template to create a Azure Container Instance for NAV 2018 with enabld Connect API and generates a sample client for it


Expand Down Expand Up @@ -52,6 +53,10 @@ Provides six commands:

Notes for the released versions

### 3.1.0

Add xlf conversion

### 3.0.0

Add the ability to create a running Azure Container Instace for NAV 2018 with enabled Connect API and generate a sample client
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "alrunner",
"displayName": "ALRunner",
"description": "Can run AL objects",
"version": "3.0.0",
"description": "Can run AL objects and a bit more",
"version": "3.1.0",
"publisher": "tfenster",
"repository": "https://github.com/tfenster/ALRunner",
"engines": {
Expand All @@ -19,6 +19,7 @@
"onCommand:extension.generateObjectsFromURL",
"onCommand:extension.generateObjectsFromEditor",
"onCommand:extension.goAzure",
"onCommand:extension.convertXlf",
"workspaceContains:initializeme.alrunner"
],
"main": "./out/src/extension",
Expand Down Expand Up @@ -51,6 +52,10 @@
{
"command": "extension.goAzure",
"title": "ALRunner: Go API on Azure!"
},
{
"command": "extension.convertXlf",
"title": "ALRunner: Convert generated xlf to real one"
}
],
"keybindings": [
Expand Down
10 changes: 10 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ export function activate(context: ExtensionContext) {
alr.goAzure();
});

let disp8 = commands.registerCommand('extension.convertXlf', () => {
alr.convertXlf(window.activeTextEditor);
});

context.subscriptions.push(disp);
context.subscriptions.push(disp2);
context.subscriptions.push(disp3);
context.subscriptions.push(disp4);
context.subscriptions.push(disp5);
context.subscriptions.push(disp6);
context.subscriptions.push(disp7);
context.subscriptions.push(disp8);

workspace.findFiles('initializeme.alrunner').then(
r => {
Expand Down Expand Up @@ -340,6 +345,11 @@ class ALRunner {

}

public convertXlf(editor: TextEditor) {
var re = /(<source>([^<]*)<\/source>)/;
this.generateAndOpenFile(editor.document.getText().replace(re, '$1\n\t\t\t\t\t<target>$2</target>'));
}

private DoGenerate(jsonText: string, entity: string, url: string) {

let jsonObject = JSON.parse(jsonText);
Expand Down

0 comments on commit 1ffaed8

Please sign in to comment.