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

@ladjs/i18n

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ladjs/i18n - npm Package Compare versions

Comparing version 3.0.6 to 3.0.7

7

lib/index.js

@@ -182,2 +182,9 @@ "use strict";

ctx.translateError = function (...args) {
const str = ctx.translate(...args);
const err = new Error(str);
err.no_translate = true;
return err;
};
return next();

@@ -184,0 +191,0 @@ }

2

package.json
{
"name": "@ladjs/i18n",
"description": "i18n wrapper and Koa middleware for Lad",
"version": "3.0.6",
"version": "3.0.7",
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",

@@ -6,0 +6,0 @@ "ava": {

@@ -68,3 +68,3 @@ # [**@ladjs/i18n**](https://github.com/ladjs/i18n)

Returns the same string as `i18n.translate`, but wrapped with a new `Error` object with a property `no_translate` and a value set to `true`.
Returns the same string as `i18n.translate`, but wrapped with a new `Error` object with a property `no_translate` set to `true`.

@@ -89,4 +89,5 @@ This is an extremely useful method if you are using `koa-better-error-handler` package in the [Lad][] framework – as it will prevent a double translation from occurring.

* `ctx.state.availableLanguages` (Array) - which is useful for adding a dropdown to select from an available language
* `ctx.state.currentLanguage` (String) - the current locale's language in native language using [country-language][]'s `getLanguage` method.
* `ctx.state.currentLanguage` (String) - the current locale's language in native language using [country-language][]'s `getLanguage` method
* `ctx.translate` (Function) - a helper function for calling `i18n.api.t` to translate a given phrase by its property key name from the `phrases` object option (same as `i18n.translate` except it throws a `ctx.throw` error using [Boom][])
* `ctx.translateError` (Function) - same as `ctx.translate` except it returns an Error object with a property `no_translate` set to `true` (similar to `i18n.translateError`)

@@ -93,0 +94,0 @@ If the given locale was not available then it will redirect the user to the detected (or default/fallback) locale.

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