internationalised the label using $.i18n (#3104)

* internationalised the label using $.i18n

* fix some problem

* make it more clear and understandable

* change prefix 'core-buttons/ to 'core-import-formats'

* formateNames to formateLabelKey

* fix spelling mistake

* add translation-en.json in pc-axis

* remove from previous file

* Add internationalized activation

* improvement in pc-axis langs

Co-authored-by: chetan <you@example.com>
This commit is contained in:
Chetan Verma 2020-10-01 15:01:29 +05:30 committed by GitHub
parent f10df46f26
commit 047d7c2de4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 20 deletions

View File

@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
function init() { function init() {
var IM = Packages.com.google.refine.importing.ImportingManager; var IM = Packages.com.google.refine.importing.ImportingManager;
IM.registerFormat("text/line-based/pc-axis", "PC-Axis text files", "PCAxisParserUI", IM.registerFormat("text/line-based/pc-axis", "pc-axis-import-format/text/line-based/pc-axis", "PCAxisParserUI",
new Packages.com.google.refine.pcaxis.PCAxisImporter()); new Packages.com.google.refine.pcaxis.PCAxisImporter());
IM.registerExtension(".px", "text/line-based/pc-axis"); IM.registerExtension(".px", "text/line-based/pc-axis");

View File

@ -0,0 +1,3 @@
{
"pc-axis-import-format/text/line-based/pc-axis": "PC-Axis text files"
}

View File

@ -31,6 +31,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
//Internationalization init
var dictionary = {};
$.ajax({
url : "command/core/load-language?",
type : "POST",
async : false,
data : {
module : "pc-axis",
},
success : function(data) {
dictionary = data['dictionary'];
lang = data['lang'];
}
});
$.i18n().load(dictionary, lang);
// End internationalization
Refine.PCAxisParserUI = function(controller, jobID, job, format, config, Refine.PCAxisParserUI = function(controller, jobID, job, format, config,
dataContainerElmt, progressContainerElmt, optionContainerElmt) { dataContainerElmt, progressContainerElmt, optionContainerElmt) {

View File

@ -204,33 +204,33 @@ function registerImporting() {
* they also generate defaults for the client-side UIs to initialize. * they also generate defaults for the client-side UIs to initialize.
*/ */
IM.registerFormat("text", "Text files"); // generic format, no parser to handle it IM.registerFormat("text", "core-import-formats/text" ); // generic format, no parser to handle it
IM.registerFormat("text/line-based", "Line-based text files", "LineBasedParserUI", IM.registerFormat("text/line-based", "core-import-formats/text/line-based", "LineBasedParserUI",
new Packages.com.google.refine.importers.LineBasedImporter()); new Packages.com.google.refine.importers.LineBasedImporter());
IM.registerFormat("text/line-based/*sv", "CSV / TSV / separator-based files", "SeparatorBasedParserUI", IM.registerFormat("text/line-based/*sv", "core-import-formats/text/line-based/*sv", "SeparatorBasedParserUI",
new Packages.com.google.refine.importers.SeparatorBasedImporter()); new Packages.com.google.refine.importers.SeparatorBasedImporter());
IM.registerFormat("text/line-based/fixed-width", "Fixed-width field text files", "FixedWidthParserUI", IM.registerFormat("text/line-based/fixed-width", "core-import-formats/text/line-based/fixed-width", "FixedWidthParserUI",
new Packages.com.google.refine.importers.FixedWidthImporter()); new Packages.com.google.refine.importers.FixedWidthImporter());
IM.registerFormat("text/rdf/nt", "RDF/N-Triples files", "RdfTriplesParserUI", IM.registerFormat("text/rdf/nt", "core-import-formats/text/rdf/nt", "RdfTriplesParserUI",
new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.NT)); new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.NT));
IM.registerFormat("text/rdf/n3", "RDF/N3 files", "RdfTriplesParserUI", IM.registerFormat("text/rdf/n3", "core-import-formats/text/rdf/n3", "RdfTriplesParserUI",
new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.N3)); new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.N3));
IM.registerFormat("text/rdf/ttl", "RDF/Turtle files", "RdfTriplesParserUI", IM.registerFormat("text/rdf/ttl", "core-import-formats/text/rdf/ttl", "RdfTriplesParserUI",
new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.TTL)); new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.TTL));
IM.registerFormat("text/rdf/xml", "RDF/XML files", "RdfTriplesParserUI", new Packages.com.google.refine.importers.RdfXmlTripleImporter()); IM.registerFormat("text/rdf/xml", "core-import-formats/text/rdf/xml", "RdfTriplesParserUI", new Packages.com.google.refine.importers.RdfXmlTripleImporter());
IM.registerFormat("text/rdf/ld+json", "JSON-LD files", "RdfTriplesParserUI", new Packages.com.google.refine.importers.RdfJsonldTripleImporter()); IM.registerFormat("text/rdf/ld+json", "core-import-formats/text/rdf/ld+json", "RdfTriplesParserUI", new Packages.com.google.refine.importers.RdfJsonldTripleImporter());
IM.registerFormat("text/xml", "XML files", "XmlParserUI", new Packages.com.google.refine.importers.XmlImporter()); IM.registerFormat("text/xml", "core-import-formats/text/xml", "XmlParserUI", new Packages.com.google.refine.importers.XmlImporter());
IM.registerFormat("binary/text/xml/xls/xlsx", "Excel files", "ExcelParserUI", new Packages.com.google.refine.importers.ExcelImporter()); IM.registerFormat("binary/text/xml/xls/xlsx", "core-import-formats/binary/text/xml/xls/xlsx", "ExcelParserUI", new Packages.com.google.refine.importers.ExcelImporter());
IM.registerFormat("text/xml/ods", "Open Document Format spreadsheets (.ods)", "ExcelParserUI", new Packages.com.google.refine.importers.OdsImporter()); IM.registerFormat("text/xml/ods", "core-import-formats/text/xml/ods", "ExcelParserUI", new Packages.com.google.refine.importers.OdsImporter());
IM.registerFormat("text/json", "JSON files", "JsonParserUI", new Packages.com.google.refine.importers.JsonImporter()); IM.registerFormat("text/json", "core-import-formats/text/json", "JsonParserUI", new Packages.com.google.refine.importers.JsonImporter());
IM.registerFormat("text/marc", "MARC files", "XmlParserUI", new Packages.com.google.refine.importers.MarcImporter()); IM.registerFormat("text/marc", "core-import-formats/text/marc", "XmlParserUI", new Packages.com.google.refine.importers.MarcImporter());
IM.registerFormat("text/wiki", "Wikitext", "WikitextParserUI", new Packages.com.google.refine.importers.WikitextImporter()); IM.registerFormat("text/wiki", "core-import-formats/text/wiki", "WikitextParserUI", new Packages.com.google.refine.importers.WikitextImporter());
IM.registerFormat("binary", "Binary files"); // generic format, no parser to handle it IM.registerFormat("binary", "core-import-formats/binary"); // generic format, no parser to handle it
IM.registerFormat("service", "Services"); // generic format, no parser to handle it IM.registerFormat("service", "core-import-formats/service"); // generic format, no parser to handle it
/* /*
* Extension to format mappings * Extension to format mappings

View File

@ -750,5 +750,22 @@
"core-buttons/match": "Match", "core-buttons/match": "Match",
"core-buttons/copy": "Copy", "core-buttons/copy": "Copy",
"core-buttons/transpose": "Transpose", "core-buttons/transpose": "Transpose",
"core-buttons/apply-to-all": "Apply to All Identical Cells" "core-buttons/apply-to-all": "Apply to All Identical Cells",
"core-import-formats/text/line-based": "Line-based text files",
"core-import-formats/text/line-based/*sv": "CSV / TSV / separator-based files",
"core-import-formats/text/line-based/fixed-width": "Fixed-width field text files",
"core-import-formats/text/rdf/nt": "RDF/N-Triples files",
"core-import-formats/text/rdf/n3": "RDF/N3 files",
"core-import-formats/text/rdf/ttl": "RDF/Turtle files",
"core-import-formats/text/rdf/xml": "RDF/XML files",
"core-import-formats/text/rdf/ld+json": "JSON-LD files",
"core-import-formats/text/xml": "XML files",
"core-import-formats/binary/text/xml/xls/xlsx": "Excel files",
"core-import-formats/text/xml/ods": "Open Document Format spreadsheets (.ods)",
"core-import-formats/text/json": "JSON files",
"core-import-formats/text/marc": "MARC files",
"core-import-formats/text/wiki": "Wikitext",
"core-import-formats/text": "Text files",
"core-import-formats/binary": "Binary files",
"core-import-formats/service": "Services"
} }

View File

@ -141,8 +141,9 @@ Refine.DefaultImportingController.prototype._prepareParsingPanel = function() {
var formats = this._job.config.rankedFormats; var formats = this._job.config.rankedFormats;
var createFormatTab = function(format) { var createFormatTab = function(format) {
var formatLabelKey =Refine.importingConfig.formats[format].label;
var tab = $('<div>') var tab = $('<div>')
.text(Refine.importingConfig.formats[format].label) .text( $.i18n(formatLabelKey))
.attr("format", format) .attr("format", format)
.addClass("default-importing-parsing-control-panel-format") .addClass("default-importing-parsing-control-panel-format")
.appendTo(self._parsingPanelElmts.formatsContainer) .appendTo(self._parsingPanelElmts.formatsContainer)