From 47a7ab15be2b28dcdebced509e44dc302983bedc Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 31 Mar 2015 15:11:38 -0400 Subject: [PATCH] refactored translator system to be a require.js module, and not a global --- public/src/admin/general/navigation.js | 4 +- public/src/admin/manage/groups.js | 7 ++-- public/src/ajaxify.js | 20 ++++++---- public/src/app.js | 26 +++++++------ public/src/client/account/edit.js | 4 +- public/src/client/account/profile.js | 4 +- public/src/client/categories.js | 4 +- public/src/client/category.js | 7 ++-- public/src/client/categoryTools.js | 4 +- public/src/client/chats.js | 4 +- public/src/client/footer.js | 4 +- public/src/client/infinitescroll.js | 4 +- public/src/client/login.js | 4 +- public/src/client/register.js | 4 +- public/src/client/topic.js | 7 ++-- public/src/client/topic/browsing.js | 4 +- public/src/client/topic/events.js | 2 +- public/src/client/topic/fork.js | 2 +- public/src/client/topic/postTools.js | 4 +- public/src/client/topic/threadTools.js | 4 +- public/src/client/users.js | 4 +- public/src/modules/alerts.js | 4 +- public/src/modules/chat.js | 4 +- public/src/modules/composer.js | 5 ++- public/src/modules/navigator.js | 2 +- public/src/modules/notifications.js | 4 +- public/src/modules/search.js | 4 +- public/src/modules/sort.js | 2 +- public/src/{ => modules}/translator.js | 54 +++++++++++++++----------- public/src/overrides.js | 8 ++-- src/controllers/helpers.js | 2 +- src/emailer.js | 2 +- src/meta/js.js | 2 - src/meta/title.js | 2 +- src/middleware/middleware.js | 2 +- src/navigation/admin.js | 2 +- src/navigation/index.js | 2 +- src/plugins.js | 2 +- src/user/create.js | 2 +- src/user/email.js | 2 +- src/user/reset.js | 2 +- 41 files changed, 128 insertions(+), 108 deletions(-) rename public/src/{ => modules}/translator.js (86%) diff --git a/public/src/admin/general/navigation.js b/public/src/admin/general/navigation.js index 9bd684ec80..c98b9fa7be 100644 --- a/public/src/admin/general/navigation.js +++ b/public/src/admin/general/navigation.js @@ -1,7 +1,7 @@ "use strict"; -/* global define, app, ajaxify, socket, templates, bootbox, translator */ +/* global define, app, ajaxify, socket, templates, bootbox */ -define('admin/general/navigation', function() { +define('admin/general/navigation', ['translator'], function(translator) { var navigation = {}, available; diff --git a/public/src/admin/manage/groups.js b/public/src/admin/manage/groups.js index ed8cc59683..f604bc9387 100644 --- a/public/src/admin/manage/groups.js +++ b/public/src/admin/manage/groups.js @@ -1,10 +1,11 @@ "use strict"; -/*global define, templates, socket, ajaxify, app, admin, bootbox, utils, config, translator */ +/*global define, templates, socket, ajaxify, app, admin, bootbox, utils, config */ define('admin/manage/groups', [ 'iconSelect', - 'admin/modules/colorpicker' -], function(iconSelect, colorpicker) { + 'admin/modules/colorpicker', + 'translator' +], function(iconSelect, colorpicker, translator) { var Groups = {}; Groups.init = function() { diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index ed5d3e8b69..9f06d03cb3 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -4,11 +4,19 @@ var ajaxify = ajaxify || {}; $(document).ready(function() { - /*global app, templates, utils, socket, translator, config, RELATIVE_PATH*/ + /*global app, templates, utils, socket, config, RELATIVE_PATH*/ var location = document.location || window.location, rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : ''), - apiXHR = null; + apiXHR = null, + + translator; + + // Dumb hack to fool ajaxify into thinking translator is still a global + // When ajaxify is migrated to a require.js module, then this can be merged into the "define" call + require(['translator'], function(_translator) { + translator = _translator; + }); $(window).on('popstate', function (ev) { ev = ev.originalEvent; @@ -49,11 +57,9 @@ $(document).ready(function() { app.template = data.template.name; - translator.load(config.defaultLang, data.template.name); - - renderTemplate(url, data.template.name, data, callback); - - require(['search'], function(search) { + require(['translator', 'search'], function(translator, search) { + translator.load(config.defaultLang, data.template.name); + renderTemplate(url, data.template.name, data, callback); search.topicDOM.end(); }); }); diff --git a/public/src/app.js b/public/src/app.js index 70c49581ab..4f2c848c0b 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -1,5 +1,5 @@ "use strict"; -/*global io, templates, translator, ajaxify, utils, bootbox, RELATIVE_PATH, config, Visibility*/ +/*global io, templates, ajaxify, utils, bootbox, RELATIVE_PATH, config, Visibility*/ var socket, app = app || {}; @@ -310,18 +310,20 @@ app.cacheBuster = null; titleObj.titles[0] = window.document.title; } - translator.translate(title, function(translated) { - titleObj.titles[1] = translated; - if (titleObj.interval) { - clearInterval(titleObj.interval); - } - - titleObj.interval = setInterval(function() { - var title = titleObj.titles[titleObj.titles.indexOf(window.document.title) ^ 1]; - if (title) { - window.document.title = $('
').html(title).text(); + require(['translator'], function(translator) { + translator.translate(title, function(translated) { + titleObj.titles[1] = translated; + if (titleObj.interval) { + clearInterval(titleObj.interval); } - }, 2000); + + titleObj.interval = setInterval(function() { + var title = titleObj.titles[titleObj.titles.indexOf(window.document.title) ^ 1]; + if (title) { + window.document.title = $('
').html(title).text(); + } + }, 2000); + }); }); } else { if (titleObj.interval) { diff --git a/public/src/client/account/edit.js b/public/src/client/account/edit.js index 86e5d1f66d..d090b0282a 100644 --- a/public/src/client/account/edit.js +++ b/public/src/client/account/edit.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, ajaxify, socket, app, config, utils, translator, bootbox */ +/* globals define, ajaxify, socket, app, config, utils, bootbox */ -define('forum/account/edit', ['forum/account/header', 'uploader'], function(header, uploader) { +define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'], function(header, uploader, translator) { var AccountEdit = {}, gravatarPicture = '', uploadedPicture = '', diff --git a/public/src/client/account/profile.js b/public/src/client/account/profile.js index 5bbf48fe85..b65b998d60 100644 --- a/public/src/client/account/profile.js +++ b/public/src/client/account/profile.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, ajaxify, app, utils, socket, translator*/ +/* globals define, ajaxify, app, utils, socket */ -define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll'], function(header, infinitescroll) { +define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll', 'translator'], function(header, infinitescroll, translator) { var Account = {}, yourid, theirid, diff --git a/public/src/client/categories.js b/public/src/client/categories.js index b00db8b4bd..f3ec819130 100644 --- a/public/src/client/categories.js +++ b/public/src/client/categories.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, socket, app, templates, translator, ajaxify*/ +/* globals define, socket, app, templates, ajaxify*/ -define('forum/categories', ['components'], function(components) { +define('forum/categories', ['components', 'translator'], function(components, translator) { var categories = {}; $(window).on('action:ajaxify.start', function(ev, data) { diff --git a/public/src/client/category.js b/public/src/client/category.js index 77228627a4..c74141feec 100644 --- a/public/src/client/category.js +++ b/public/src/client/category.js @@ -1,5 +1,5 @@ "use strict"; -/* global define, config, templates, app, utils, ajaxify, socket, translator */ +/* global define, config, templates, app, utils, ajaxify, socket */ define('forum/category', [ 'composer', @@ -9,8 +9,9 @@ define('forum/category', [ 'navigator', 'forum/categoryTools', 'sort', - 'components' -], function(composer, pagination, infinitescroll, share, navigator, categoryTools, sort, components) { + 'components', + 'translator' +], function(composer, pagination, infinitescroll, share, navigator, categoryTools, sort, components, translator) { var Category = {}; $(window).on('action:ajaxify.start', function(ev, data) { diff --git a/public/src/client/categoryTools.js b/public/src/client/categoryTools.js index 749aca5dad..d5e69d1312 100644 --- a/public/src/client/categoryTools.js +++ b/public/src/client/categoryTools.js @@ -1,10 +1,10 @@ 'use strict'; -/* globals define, app, translator, socket, bootbox, ajaxify */ +/* globals define, app, socket, bootbox, ajaxify */ -define('forum/categoryTools', ['forum/topic/move', 'topicSelect', 'components'], function(move, topicSelect, components) { +define('forum/categoryTools', ['forum/topic/move', 'topicSelect', 'components', 'translator'], function(move, topicSelect, components, translator) { var CategoryTools = {}; diff --git a/public/src/client/chats.js b/public/src/client/chats.js index 9ea8beea57..d506d81654 100644 --- a/public/src/client/chats.js +++ b/public/src/client/chats.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, app, ajaxify, utils, socket, templates, translator */ +/* globals define, app, ajaxify, utils, socket, templates */ -define('forum/chats', ['string', 'sounds', 'forum/infinitescroll'], function(S, sounds, infinitescroll) { +define('forum/chats', ['string', 'sounds', 'forum/infinitescroll', 'translator'], function(S, sounds, infinitescroll, translator) { var Chats = { initialised: false }; diff --git a/public/src/client/footer.js b/public/src/client/footer.js index 7a479308f0..5e39ac142c 100644 --- a/public/src/client/footer.js +++ b/public/src/client/footer.js @@ -1,7 +1,7 @@ "use strict"; -/*globals define, app, translator, socket*/ +/*globals define, app, socket*/ -define('forum/footer', ['notifications', 'chat', 'components'], function(Notifications, Chat, components) { +define('forum/footer', ['notifications', 'chat', 'components', 'translator'], function(Notifications, Chat, components, translator) { Notifications.prepareDOM(); Chat.prepareDOM(); diff --git a/public/src/client/infinitescroll.js b/public/src/client/infinitescroll.js index ba3385d92f..7c79da1e79 100644 --- a/public/src/client/infinitescroll.js +++ b/public/src/client/infinitescroll.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, socket, ajaxify, translator, templates, app */ +/* globals define, socket, ajaxify, templates, app */ -define('forum/infinitescroll', function() { +define('forum/infinitescroll', ['translator'], function(translator) { var scroll = {}; var callback; diff --git a/public/src/client/login.js b/public/src/client/login.js index dc199f3d2f..3032e3b35d 100644 --- a/public/src/client/login.js +++ b/public/src/client/login.js @@ -1,7 +1,7 @@ "use strict"; -/* global define, app, translator, config, RELATIVE_PATH */ +/* global define, app, config, RELATIVE_PATH */ -define('forum/login', ['csrf'], function(csrf) { +define('forum/login', ['csrf', 'translator'], function(csrf, translator) { var Login = {}; Login.init = function() { diff --git a/public/src/client/register.js b/public/src/client/register.js index 636b8be306..cab41bb72f 100644 --- a/public/src/client/register.js +++ b/public/src/client/register.js @@ -1,9 +1,9 @@ 'use strict'; -/* globals define, app, utils, socket, config, translator */ +/* globals define, app, utils, socket, config */ -define('forum/register', ['csrf'], function(csrf) { +define('forum/register', ['csrf', 'translator'], function(csrf, translator) { var Register = {}, validationError = false, successIcon = ''; diff --git a/public/src/client/topic.js b/public/src/client/topic.js index a42cb7ff50..3e087879d2 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -1,7 +1,7 @@ 'use strict'; -/* globals define, app, templates, translator, socket, bootbox, config, ajaxify, RELATIVE_PATH, utils */ +/* globals define, app, templates, socket, bootbox, config, ajaxify, RELATIVE_PATH, utils */ define('forum/topic', [ 'forum/pagination', @@ -13,8 +13,9 @@ define('forum/topic', [ 'forum/topic/posts', 'navigator', 'sort', - 'components' -], function(pagination, infinitescroll, threadTools, postTools, events, browsing, posts, navigator, sort, components) { + 'components', + 'translator' +], function(pagination, infinitescroll, threadTools, postTools, events, browsing, posts, navigator, sort, components, translator) { var Topic = {}, currentUrl = ''; diff --git a/public/src/client/topic/browsing.js b/public/src/client/topic/browsing.js index 7c14fab158..5cb71960ea 100644 --- a/public/src/client/topic/browsing.js +++ b/public/src/client/topic/browsing.js @@ -2,9 +2,9 @@ 'use strict'; -/* globals define, app, translator, config, socket, ajaxify */ +/* globals define, app, config, socket, ajaxify */ -define('forum/topic/browsing', function() { +define('forum/topic/browsing', ['translator'], function(translator) { var Browsing = {}; diff --git a/public/src/client/topic/events.js b/public/src/client/topic/events.js index b38f752138..f47108c7e1 100644 --- a/public/src/client/topic/events.js +++ b/public/src/client/topic/events.js @@ -1,7 +1,7 @@ 'use strict'; -/* globals app, ajaxify, define, socket, translator, templates */ +/* globals app, ajaxify, define, socket, templates */ define('forum/topic/events', [ 'forum/topic/browsing', diff --git a/public/src/client/topic/fork.js b/public/src/client/topic/fork.js index 63f2be0b63..5321202e49 100644 --- a/public/src/client/topic/fork.js +++ b/public/src/client/topic/fork.js @@ -1,6 +1,6 @@ 'use strict'; -/* globals define, app, ajaxify, translator, socket */ +/* globals define, app, ajaxify, socket */ define('forum/topic/fork', ['components'], function(components) { diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index 446ee1f1c3..b3686a7e3c 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, app, ajaxify, bootbox, socket, templates, translator, utils */ +/* globals define, app, ajaxify, bootbox, socket, templates, utils */ -define('forum/topic/postTools', ['composer', 'share', 'navigator', 'components'], function(composer, share, navigator, components) { +define('forum/topic/postTools', ['composer', 'share', 'navigator', 'components', 'translator'], function(composer, share, navigator, components, translator) { var PostTools = {}, topicName; diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.js index d3504a7875..46a20d19b9 100644 --- a/public/src/client/topic/threadTools.js +++ b/public/src/client/topic/threadTools.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, app, translator, ajaxify, socket, bootbox */ +/* globals define, app, ajaxify, socket, bootbox */ -define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'components'], function(fork, move, components) { +define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'components', 'translator'], function(fork, move, components, translator) { var ThreadTools = {}; diff --git a/public/src/client/users.js b/public/src/client/users.js index 6b08f05cdd..3e794a008a 100644 --- a/public/src/client/users.js +++ b/public/src/client/users.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, socket, app, ajaxify, templates, translator*/ +/* globals define, socket, app, ajaxify, templates */ -define('forum/users', function() { +define('forum/users', ['translator'], function(translator) { var Users = {}; var loadingMoreUsers = false; diff --git a/public/src/modules/alerts.js b/public/src/modules/alerts.js index 15f592720e..78ec9721c5 100644 --- a/public/src/modules/alerts.js +++ b/public/src/modules/alerts.js @@ -1,7 +1,7 @@ 'use strict'; -/* globals define, translator, templates */ +/* globals define, templates */ -define('alerts', function() { +define('alerts', ['translator'], function(translator) { var module = {}; module.alert = function (params) { diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 760f19ca20..da25e104d5 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -1,7 +1,7 @@ "use strict"; -/* globals app, config, define, socket, translator, templates, utils, ajaxify */ +/* globals app, config, define, socket, templates, utils, ajaxify */ -define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar, S, sounds, Chats) { +define('chat', ['taskbar', 'string', 'sounds', 'forum/chats', 'translator'], function(taskbar, S, sounds, Chats, translator) { var module = {}; var newMessage = false; diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 9545759395..f6dc3b9b31 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -1,9 +1,10 @@ 'use strict'; -/* globals define, socket, app, config, ajaxify, utils, translator, templates, bootbox */ +/* globals define, socket, app, config, ajaxify, utils, templates, bootbox */ define('composer', [ 'taskbar', + 'translator', 'composer/controls', 'composer/uploads', 'composer/formatting', @@ -12,7 +13,7 @@ define('composer', [ 'composer/categoryList', 'composer/preview', 'composer/resize' -], function(taskbar, controls, uploads, formatting, drafts, tags, categoryList, preview, resize) { +], function(taskbar, translator, controls, uploads, formatting, drafts, tags, categoryList, preview, resize) { var composer = { active: undefined, posts: {}, diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index 263c905d33..9404c885d9 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -1,7 +1,7 @@ 'use strict'; -/* globals app, define, ajaxify, utils, translator, config */ +/* globals app, define, ajaxify, utils, config */ define('navigator', ['forum/pagination', 'components'], function(pagination, components) { diff --git a/public/src/modules/notifications.js b/public/src/modules/notifications.js index 43ba05ed1b..3f342a1207 100644 --- a/public/src/modules/notifications.js +++ b/public/src/modules/notifications.js @@ -1,8 +1,8 @@ 'use strict'; -/* globals define, socket, translator, utils, config, app, ajaxify, templates, Tinycon*/ +/* globals define, socket, utils, config, app, ajaxify, templates, Tinycon*/ -define('notifications', ['sounds'], function(sound) { +define('notifications', ['sounds', 'translator'], function(sound, translator) { var Notifications = {}; Notifications.prepareDOM = function() { diff --git a/public/src/modules/search.js b/public/src/modules/search.js index eedf0b76b9..e17b234656 100644 --- a/public/src/modules/search.js +++ b/public/src/modules/search.js @@ -1,7 +1,7 @@ "use strict"; -/* globals socket, ajaxify, translator, app, define */ +/* globals socket, ajaxify, app, define */ -define('search', ['navigator'], function(nav) { +define('search', ['navigator', 'translator'], function(nav, translator) { var Search = { current: {} diff --git a/public/src/modules/sort.js b/public/src/modules/sort.js index 3aad14dc44..e063fceda3 100644 --- a/public/src/modules/sort.js +++ b/public/src/modules/sort.js @@ -1,5 +1,5 @@ 'use strict'; -/* globals define, config, socket, app, ajaxify, translator, templates */ +/* globals define, config, socket, app, ajaxify, templates */ define('sort', function() { var module = {}; diff --git a/public/src/translator.js b/public/src/modules/translator.js similarity index 86% rename from public/src/translator.js rename to public/src/modules/translator.js index d1b85e300c..ac3be2728e 100644 --- a/public/src/translator.js +++ b/public/src/modules/translator.js @@ -1,18 +1,18 @@ -(function (module) { +;(function(translator) { "use strict"; - /*global RELATIVE_PATH, config*/ + /* globals RELATIVE_PATH, config, define */ + // export the class if we are in a Node-like system. + if (typeof module === 'object' && module.exports === translator) { + exports = module.exports = translator; + } - var translator = {}, - languages = {}; - - var regexes = { - match: /\[\[.*?\]\]/g, - split: /[,][\s]*/, - replace: /\]+$/ - }; - - module.exports = translator; + var languages = {}, + regexes = { + match: /\[\[.*?\]\]/g, + split: /[,][\s]*/, + replace: /\]+$/ + }; translator.addTranslation = function(language, filename, translations) { languages[language] = languages[language] || {}; @@ -127,7 +127,7 @@ if ('undefined' !== typeof window && config) { language = config.userLang || 'en_GB'; } else { - var meta = require('../../src/meta'); + var meta = require('../../../src/meta'); language = meta.config.defaultLang || 'en_GB'; } } @@ -267,16 +267,16 @@ var fs = require('fs'), path = require('path'), winston = require('winston'), - meta = require('../../src/meta'); + meta = require('../../../src/meta'); language = language || meta.config.defaultLang || 'en_GB'; - if (!fs.existsSync(path.join(__dirname, '../language', language))) { + if (!fs.existsSync(path.join(__dirname, '../../language', language))) { winston.warn('[translator] Language \'' + meta.config.defaultLang + '\' not found. Defaulting to \'en_GB\''); language = 'en_GB'; } - fs.readFile(path.join(__dirname, '../language', language, filename + '.json'), function(err, data) { + fs.readFile(path.join(__dirname, '../../language', language, filename + '.json'), function(err, data) { if (err) { winston.error('Could not load `' + filename + '`: ' + err.message + '. Skipping...'); return callback({}); @@ -291,12 +291,20 @@ }); } - if ('undefined' !== typeof window) { - window.translator = module.exports; - } + // Use the define() function if we're in AMD land + if (typeof define === 'function' && define.amd) { + define('translator', translator); -})('undefined' === typeof module ? { - module: { - exports: {} + // Expose a global `translator` object for backwards compatibility + window.translator = { + translate: function() { + console.warn('[translator] Global invocation of the translator is now deprecated, please `require` the module instead.'); + translator.translate.apply(translator, arguments); + } + } } -} : module); +})( + typeof exports === 'object' ? exports : + typeof define === 'function' && define.amd ? {} : + translator = {} +); \ No newline at end of file diff --git a/public/src/overrides.js b/public/src/overrides.js index afe5003b3c..8c0e492cce 100644 --- a/public/src/overrides.js +++ b/public/src/overrides.js @@ -1,11 +1,13 @@ 'use strict'; -/*globals translator*/ - - if ('undefined' !== typeof window) { (function ($, undefined) { + var translator; + require(['translator'], function(_translator) { + translator = _translator; + }); + $.fn.getCursorPosition = function() { var el = $(this).get(0); var pos = 0; diff --git a/src/controllers/helpers.js b/src/controllers/helpers.js index 3b3faa0622..0b100aad49 100644 --- a/src/controllers/helpers.js +++ b/src/controllers/helpers.js @@ -4,7 +4,7 @@ var nconf = require('nconf'), async = require('async'), validator = require('validator'), - translator = require('../../public/src/translator'), + translator = require('../../public/src/modules/translator'), categories = require('../categories'), plugins = require('../plugins'), meta = require('../meta'); diff --git a/src/emailer.js b/src/emailer.js index aeca1ecab8..a7a0b67302 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -9,7 +9,7 @@ var fs = require('fs'), User = require('./user'), Plugins = require('./plugins'), meta = require('./meta'), - translator = require('../public/src/translator'), + translator = require('../public/src/modules/translator'), app; diff --git a/src/meta/js.js b/src/meta/js.js index 85188ab3f7..52366651cf 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -44,9 +44,7 @@ module.exports = function(Meta) { 'public/src/utils.js', 'public/src/app.js', 'public/src/ajaxify.js', - 'public/src/components.js', 'public/src/overrides.js', - 'public/src/translator.js', 'public/src/variables.js', 'public/src/widgets.js' ], diff --git a/src/meta/title.js b/src/meta/title.js index 11af43ae9b..d67c448343 100644 --- a/src/meta/title.js +++ b/src/meta/title.js @@ -3,7 +3,7 @@ var winston = require('winston'), validator = require('validator'), user = require('../user'), - translator = require('../../public/src/translator'); + translator = require('../../public/src/modules/translator'); module.exports = function(Meta) { Meta.title = {}; diff --git a/src/middleware/middleware.js b/src/middleware/middleware.js index b46376f590..cc3ae7cb5c 100644 --- a/src/middleware/middleware.js +++ b/src/middleware/middleware.js @@ -14,7 +14,7 @@ var app, plugins = require('./../plugins'), navigation = require('./../navigation'), meta = require('./../meta'), - translator = require('./../../public/src/translator'), + translator = require('./../../public/src/modules/translator'), user = require('./../user'), groups = require('./../groups'), db = require('./../database'), diff --git a/src/navigation/admin.js b/src/navigation/admin.js index a0f62035b4..d608e1b620 100644 --- a/src/navigation/admin.js +++ b/src/navigation/admin.js @@ -5,7 +5,7 @@ var admin = {}, async = require('async'), plugins = require('../plugins'), db = require('../database'), - translator = require('../../public/src/translator'); + translator = require('../../public/src/modules/translator'); admin.save = function(data, callback) { diff --git a/src/navigation/index.js b/src/navigation/index.js index 98d575a261..b9a8a99e16 100644 --- a/src/navigation/index.js +++ b/src/navigation/index.js @@ -5,7 +5,7 @@ var navigation = {}, plugins = require('../plugins'), db = require('../database'), admin = require('./admin'), - translator = require('../../public/src/translator'); + translator = require('../../public/src/modules/translator'); navigation.get = function(callback) { diff --git a/src/plugins.js b/src/plugins.js index c63039be67..3a9d1ff5fe 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -11,7 +11,7 @@ var fs = require('fs'), db = require('./database'), emitter = require('./emitter'), meta = require('./meta'), - translator = require('../public/src/translator'), + translator = require('../public/src/modules/translator'), utils = require('../public/src/utils'), hotswap = require('./hotswap'), diff --git a/src/user/create.js b/src/user/create.js index d02635a550..90bd39e7d1 100644 --- a/src/user/create.js +++ b/src/user/create.js @@ -8,7 +8,7 @@ var async = require('async'), groups = require('../groups'), meta = require('../meta'), notifications = require('../notifications'), - translator = require('../../public/src/translator'); + translator = require('../../public/src/modules/translator'); module.exports = function(User) { diff --git a/src/user/email.js b/src/user/email.js index e7f56ed21a..973a7e844e 100644 --- a/src/user/email.js +++ b/src/user/email.js @@ -7,7 +7,7 @@ var async = require('async'), user = require('../user'), utils = require('../../public/src/utils'), - translator = require('../../public/src/translator'), + translator = require('../../public/src/modules/translator'), plugins = require('../plugins'), db = require('../database'), meta = require('../meta'), diff --git a/src/user/reset.js b/src/user/reset.js index 7434c4fc30..9df72a8177 100644 --- a/src/user/reset.js +++ b/src/user/reset.js @@ -6,7 +6,7 @@ var async = require('async'), user = require('../user'), utils = require('../../public/src/utils'), - translator = require('../../public/src/translator'), + translator = require('../../public/src/modules/translator'), db = require('../database'), meta = require('../meta'),