1 # This file provides a simple function for getting the localized version of a
4 PROPERTIES_FILE = 'vimfx.properties'
6 stringBundle = Services.strings.createBundle(
7 # Randomize URI to work around bug 719376.
8 "#{ADDON_PATH}/locale/#{PROPERTIES_FILE}?#{Math.random()}"
11 translate = (name, values...) ->
13 return stringBundle.formatStringFromName(name, values, values.length)
15 # If you accidentally pass a `name` that does not exist in a '.properties'
16 # file the thrown error is terrible. It only tells you that an error
17 # occurred, but not why. Wrap in a try-catch to fix that.
18 console.error('VimFx: Translation error', name, values, error)
20 module.exports = translate