Introduce vc.getName()
Change-Id: I7a069b792f83d9f5d598c2bf8e44fdc7afaeb2f1
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 07731c7..5d2b498 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -81,6 +81,8 @@
const loc = KorAP.Locale;
loc.SHOW_STAT = loc.SHOW_STAT || 'Statistics';
loc.VERB_SHOWSTAT = loc.VERB_SHOWSTAT || 'Corpus Statistics';
+ loc.VC_allCorpora = loc.VC_allCorpora || 'all corpora';
+ loc.VC_oneCollection = loc.VC_oneCollection || 'a virtual corpus';
KorAP._vcKeyMenu = undefined;
KorAP._vcDatePicker = dpClass.create();
@@ -167,6 +169,7 @@
return obj;
},
+
/**
* Create and render a new virtual collection based on a KoralQuery
* collection document
@@ -204,7 +207,7 @@
return this;
},
-
+
// Check if the virtual corpus contains a rewrite
// This is a class method
checkRewrite : function(json) {
@@ -339,6 +342,21 @@
this.update();
},
+
+ // Get the reference name
+ getName : function () {
+ if (this._root.ldType() === 'non') {
+ return loc.VC_allCorpora;
+ }
+ else if (this._root.ldType() === 'docGroupRef') {
+ return this._root.ref();
+ }
+ else {
+ return loc.VC_oneCollection;
+ }
+ },
+
+
/**
* Get the generated json string
*/