@metamask/get-locale-example-snap

2.0.1 • Public • Published

@metamask/get-locale-example-snap

This snap demonstrates how to use snap_getLocale JSON-RPC method to get the currently selected user locale from the MetaMask extension, and use it in a snap.

Snap manifest

Note: Using snap_getLocale requires the snap_getLocale permissions. Refer to the documentation for more information.

Along with other permissions, the manifest of this snap includes the snap_getLocale permission:

{
  "initialPermissions": {
    "snap_getLocale": {}
  }
}

This permission does not require any additional configuration.

Snap usage

This snap exposes an onRpcRequest handler, which supports the following JSON-RPC methods:

  • hello: Shows an alert dialog with a localized message, using both snap_dialog and snap_getLocale.

For more information, you can refer to the end-to-end tests.

/@metamask/get-locale-example-snap/

    Package Sidebar

    Install

    npm i @metamask/get-locale-example-snap

    Weekly Downloads

    6

    Version

    2.0.1

    License

    (MIT-0 OR Apache-2.0)

    Unpacked Size

    5.92 MB

    Total Files

    9

    Last publish

    Collaborators

    • mcmire
    • nicholasellul
    • lgbot
    • naugtur
    • ritave
    • danfinlay
    • kumavis
    • rekmarks
    • metamaskbot
    • gudahtt
    • sethkfman