Skip to content

Instantly share code, notes, and snippets.

@whs
Created December 2, 2019 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whs/69be4fe8628afb53932b30e933211bce to your computer and use it in GitHub Desktop.
Save whs/69be4fe8628afb53932b30e933211bce to your computer and use it in GitHub Desktop.
import template from 'babel-template'
const I18n$tCall = template('I18n.$t({th: TH, en: EN})')
export default function({types: t}){
return {
visitor: {
CallExpression(path) {
// ...
path.replaceWith(I18n$tCall({
TH: import มา,
EN: import มา,
}))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment