Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@inlang/paraglide-js

Package Overview
Dependencies
Maintainers
0
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inlang/paraglide-js

[![Inlang-ecosystem compatibility badge](https://cdn.jsdelivr.net/gh/opral/monorepo@main/inlang/assets/md-badges/inlang.svg)](https://inlang.com)

  • 1.11.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
increased by12.84%
Maintainers
0
Weekly downloads
 
Created
Source

Inlang-ecosystem compatibility badge

Getting started

To use Paraglide standalone without a framework, run the following command:

npx @inlang/paraglide-js@latest init

This will:

  • Install necessary dependencies
  • Generate a messages/ folder where your translation files live
  • Add the Paraglide compiler to your build script in package.json
  • Create necessary configuration files

Running the Paraglide compiler will generate a src/paraglide folder. This folder contains all the code that you will use in your app.

Adding and Editing Messages

Messages are stored in messages/{lang}.json as key-value pairs. You can add parameters with curly braces.

// messages/en.json
{
	"$schema": "https://inlang.com/schema/inlang-message-format",
+ 	"greeting": "Hello {name}!"
}

Make sure to re-run the paraglide compiler after editing your messages.

npx @inlang/paraglide-js compile --project ./project.inlang --outdir ./src/paraglide

If you are using a Bundler use one of the Bundler Plugins to recompile automatically.

Using Messages in Code

After running the compiler import the messages with import * as m from "./paraglide/messages". By convention, a wildcard import is used.

import * as m from "./paraglide/messages.js"

m.hello() // Hello world!
m.loginHeader({ name: "Samuel" }) // Hello Samuel, please login to continue.

Playground

Find examples of how to use Paraglide on CodeSandbox or in our GitHub repository.

Roadmap

Of course, we're not done yet! We plan on adding the following features to Paraglide JS soon:

Talks

Keywords

FAQs

Package last updated on 25 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc