Commit 96b14aba authored by Adrien Pavie's avatar Adrien Pavie
Browse files

Loading locales file in Main

parent e88ec8d3
......@@ -84,6 +84,7 @@ var OLU = {
Routing: require("./ctrl/service/Routing"),
URL: require("./ctrl/service/URL"),
Search: require("./ctrl/service/Search"),
Translator: require("./ctrl/service/Translator")
}
},
util: require("./utils")
......
......@@ -17,6 +17,7 @@
var $ = require("jquery");
var L = require("leaflet");
var yaml = require("js-yaml");
var RuleSet = require("../model/mapcss/RuleSet");
var MainView = require("../view/Main");
......@@ -27,6 +28,7 @@ var ServiceSearch = require("./service/Search");
var ProviderDataOSM = require("./provider/data/OSM");
var ProviderDataNotes = require("./provider/data/Notes");
var ProviderPictureFlickr = require("./provider/picture/Flickr");
var Translator = require("./service/Translator");
/**
* Main controller is the master of puppets.
......@@ -57,6 +59,10 @@ var Main = function(divId, mode, config) {
"styles/details.mapcss"
],
"locales": [
"locales/en.yaml"
],
"api": {
"overpass": "http://api.openstreetmap.fr/oapi/interpreter/?data=",
"overpass_alt": "http://www.overpass-api.de/api/interpreter?data=",
......@@ -328,6 +334,9 @@ var Main = function(divId, mode, config) {
/** Search **/
this.search = new ServiceSearch(this.config.api.nominatim);
/** Translator **/
this.translator = new Translator();
/*
* Providers
*/
......@@ -353,6 +362,22 @@ var Main = function(divId, mode, config) {
options.tile = (this.url.getParameter("tile") != null) ? parseInt(this.url.getParameter("tile")) : undefined;
options.style = (this.url.getParameter("style") != null) ? this.url.getParameter("style") : undefined;
/*
* Init locales
*/
for(var lngId=0; lngId < this.config.locales.length; lngId++) {
//TODO
$.ajax({
url: this.config.locales[lngId],
async: false,
dataType: 'text',
success: function(data) {
var locale = yaml.safeLoad(data);
console.log(locale);
}.bind(this)
}).fail(function() { throw new Error("[Controller] Error while retrieving locales file: "+this.config.locales[lngId]); }.bind(this));
}
/*
* Init main view
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment