Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n #hacktoberfest #4

Closed
2 tasks done
Tracked by #1
afrianjunior opened this issue Nov 8, 2022 · 1 comment
Closed
2 tasks done
Tracked by #1

i18n #hacktoberfest #4

afrianjunior opened this issue Nov 8, 2022 · 1 comment

Comments

@afrianjunior
Copy link
Member

afrianjunior commented Nov 8, 2022

i18n is a library to allow you to access wording from JSON (extracted by CLI) by key.

TODO:

  • API for an extract from key, ex: tbuy
  • config option for selecting a language and source location

Requirements:

  • write this package under babel-macros

Example:

API translation

import { t } from 'i18n.macro'

function Render () {
  return t`buy`
}

Config package.json

{
  "name": "@efishery/i18n",
  "babelMacros": {
    "i18n.macro": {
      "lang": "id",
      "source": "<json path>"
    }
  }
}
@afrianjunior
Copy link
Member Author

all done, thanks to @r17x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant