
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
[Fluent](https://projectfluent.org/) is an great **DSL** for **localization**. This project allows you to generate **TypeScript** types for yours `.ftl` files.
Fluent is an great DSL for localization. This project allows you to generate TypeScript types for yours .ftl files.
Npm:
npx fluent2ts
Bun:
bunx fluent2ts
Yarn:
yarn dlx fluent2ts
Pnpm:
pnpm exec fluent2ts
After that, the locales.types.ts file is automatically generated in the src folder. You can also change this path by specifying the -o (or --output) argument. For example - npx fluent2ts -o src/some/i18n.ts.
You can also specify the glob pattern to search for .ftl files are specified after the command. For example npx fluent2ts locales/**/*.ftl. By default it is **/*.ftl.
You can also use watch mode and regenerate the types when the file has been modified. To do this, simply specify the --watch (or -w) argument. For example, npx fluent2ts -w.
https://github.com/kravetsone/fluent2ts/assets/57632712/318350a0-318a-43a0-82f6-b70cdb431ab6
For example for this:
# Simple things are simple.
hello-user = Hello, {$userName}!
# Complex things are possible.
shared-photos =
{$userName} {$photoCount ->
[one] added a new photo
*[other] added {$photoCount} new photos
} to {$userGender ->
[male] his stream
[female] her stream
*[other] their stream
}.
The following will be generated:
import type {
FluentBundle,
FluentVariable,
Message as FluentMessage,
// @ts-ignore
} from "@fluent/bundle";
export interface LocalesMap {
"hello-user": {
userName: FluentVariable;
};
"shared-photos": {
userName: FluentVariable;
photoCount: FluentVariable;
userGender: FluentVariable;
};
}
export interface Message<Key extends keyof LocalesMap> extends FluentMessage {
id: Key;
}
export interface TypedFluentBundle extends FluentBundle {
getMessage<Key extends keyof LocalesMap>(key: Key): Message<Key>;
formatPattern<Key extends keyof LocalesMap>(
key: Key,
...args: LocalesMap[Key] extends never ? [] : [args: LocalesMap[Key]]
): string;
formatPattern<Key extends keyof LocalesMap>(
key: Key,
args: LocalesMap[Key] extends never ? null : LocalesMap[Key],
errors?: Error[] | null
): string;
}
FAQs
[Fluent](https://projectfluent.org/) is an great **DSL** for **localization**. This project allows you to generate **TypeScript** types for yours `.ftl` files.
We found that fluent2ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.