• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2
3const path = require('path')
4const y18n = require('y18n')({
5  directory: path.join(__dirname, '../../locales'),
6  locale: 'en',
7  updateFiles: process.env.CACACHE_UPDATE_LOCALE_FILES === 'true'
8})
9
10module.exports = yTag
11function yTag (parts) {
12  let str = ''
13  parts.forEach((part, i) => {
14    const arg = arguments[i + 1]
15    str += part
16    if (arg) {
17      str += '%s'
18    }
19  })
20  return y18n.__.apply(null, [str].concat([].slice.call(arguments, 1)))
21}
22
23module.exports.setLocale = locale => {
24  y18n.setLocale(locale)
25}
26