UNPKG

i18n-list

Version:

Small i18n-node extension adding function __l which returns a list of known translations for a key

13 lines (10 loc) 276 B
module.exports = function(i18n) { i18n.__l = function(key) { var translations = []; Object.keys(i18n.getCatalog()).forEach(function(locale) { translations.push( i18n.__({phrase: key, locale: locale}) ); }); return translations; } return i18n; };