Treat translations plugin as any other OP plugin

Replace special handling with simple entry point in
openproject-translations plugin.
See 4fe08c6e64

Bug # 14679

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/2193/head
Alex Coles 10 years ago
parent 5a6202a4f8
commit 4ea7cb0e1c
  1. 21
      config/rails-plugins.conf.js
  2. 7
      frontend/app/openproject-app.js
  3. 1
      webpack.config.js

@ -70,26 +70,5 @@ var OpenProjectPlugins = {
}
};
var TranslationsPlugin = {
envPath: function() {
if (env['OPENPROJECT_TRANSLATIONS_ROOT']) {
return path.resolve(__dirname, '..', env['OPENPROJECT_TRANSLATIONS_ROOT']);
}
},
findPluginPath: function() {
return this.envPath() || OpenProjectPlugins.findPluginPath('openproject-translations') || '';
},
findLocaleFiles: function() {
var localeFilePath = path.join(this.findPluginPath(), 'config', 'locales');
return find(localeFilePath).filter(function(file) {
return file.match(/js-([\w|-]){2,5}\.yml$/);
});
}
};
exports.pluginNamesPaths = OpenProjectPlugins.pluginNamesPaths();
exports.pluginDirectories = OpenProjectPlugins.pluginDirectories();
exports.translationsPluginLocales = TranslationsPlugin.findLocaleFiles();
exports.translationsPluginPath = TranslationsPlugin.findPluginPath();

@ -32,13 +32,6 @@ var I18n = require('./vendor/i18n');
I18n.translations.en = require("locales/js-en.yml").en;
I18n.translations.de = require("locales/js-de.yml").de;
// extra locales, automatically loaded
var requireExtraLocale = require.context('extra-locales', false, /js-[\w|-]{2,5}\.yml$/);
requireExtraLocale.keys().forEach(function(localeFile) {
var locale = localeFile.match(/js-([\w|-]{2,5})\.yml/)[1];
I18n.translations[locale] = requireExtraLocale(localeFile)[locale];
});
I18n.addTranslations = function(locale, translations) {
I18n.translations[locale] = _.merge(I18n.translations[locale], translations);
};

@ -43,7 +43,6 @@ module.exports = {
alias: _.merge({
'locales': 'config/locales',
'extra-locales': path.join(pathConfig.translationsPluginPath, 'config', 'locales'),
'angular-ui-date': 'angular-ui-date/src/date',
'angular-truncate': 'angular-truncate/src/truncate',

Loading…
Cancel
Save