Skip to content

Commit

Permalink
Review Requests:
Browse files Browse the repository at this point in the history
adoption in Readme.md,
eslint in .eslintignore instead of manual modification after generation of files
special value for German language and test against,
correct behavior for return / AMD module exports
  • Loading branch information
HeikoStudt committed Sep 25, 2020
1 parent 4185189 commit 6bcf9e6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node/**
node_modules/**
test/js/**
test/TestCases/loaders/i18nTypeScriptModules/nls/**
coverage/**

6 changes: 4 additions & 2 deletions loaders/dojo/i18nEval.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ module.exports = function(bundle) {
// we need the latter as our result
var exp = {};
var requireFun = function() { throw new Error("require() is not supported in language files"); };
arg2(requireFun, exp);
result = exp;
result = arg2(requireFun, exp);
if (typeof result === 'undefined') {
result = exp;
}

} else {
throw new Error("define dependencies not supported in langauge files!");
Expand Down
13 changes: 5 additions & 8 deletions test/TestCases/loaders/i18nTypeScriptModules/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ data.

This needs to be addressed by dojo-webpack-plugin.

# How to use the *.ts typescript files?
Install Typescript with its tsc transpiler somewhere.
# How to generate out of the *.ts typescript files?
Install Typescript (>3) and call tsc here.

Go to this folder.

tsc

Edit the generated nls/* files and adapt for esLint with a line comment:
eslint-disable-next-line no-unused-vars
# EsLintIgnore
The generated files nls/* are ignored for eslint, because otherwise
no-unused-vars will error.
2 changes: 1 addition & 1 deletion test/TestCases/loaders/i18nTypeScriptModules/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define(["dojo/i18n!./nls/strings", "./nls/de-at/strings"], function(strings) {
it("should load the strings if generated with typescript (require, exports)", function() {
strings.hello.should.be.eql("xyz");
strings.hello.should.be.eql("xyz-de");
});
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// eslint-disable-next-line no-unused-vars
define(["require", "exports"], function (require, exports) {
"use strict";
return {
hello: 'xyz'
hello: 'xyz-de'
};
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line no-unused-vars
define(["require", "exports"], function (require, exports) {
"use strict";
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export = {
hello : 'xyz'
hello : 'xyz-de'
}

0 comments on commit 6bcf9e6

Please sign in to comment.