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

@markuplint/i18n

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/i18n - npm Package Compare versions

Comparing version 2.0.0-rc.5 to 2.0.0

4

lib/translator.d.ts

@@ -6,2 +6,4 @@ import type { LocaleSet, Primitive, Translator } from './types';

*/
export declare function taggedTemplateTranslator(localeSet?: LocaleSet): (strings: TemplateStringsArray, ...keys: Primitive[]) => string;
export declare function taggedTemplateTranslator(
localeSet?: LocaleSet,
): (strings: TemplateStringsArray, ...keys: Primitive[]) => string;
export declare type Translator = (messageTmpl: string | string[], ...keywords: Primitive[]) => string;
export declare type LocaleSet = {
locale: string;
listFormat?: ListFormat;
keywords?: LocalesKeywords;
sentences?: LocalesKeywords;
locale: string;
listFormat?: ListFormat;
keywords?: LocalesKeywords;
sentences?: LocalesKeywords;
};
export declare type ListFormat = {
quoteStart: string;
quoteEnd: string;
separator: string;
quoteStart: string;
quoteEnd: string;
separator: string;
};
export declare type Primitive = string | number | boolean;
export declare type LocalesKeywords = {
[messageId: string]: string | void;
[messageId: string]: string | void;
};
{
"name": "@markuplint/i18n",
"version": "2.0.0-rc.5",
"version": "2.0.0",
"description": "HTML parser for markuplint",

@@ -18,3 +18,3 @@ "repository": "git@github.com:markuplint/markuplint.git",

},
"gitHead": "7c93367a86f935f6b94780b1fa14f3293f900b87"
"gitHead": "de81fc514acdf472f87184e3499e9364258f9b66"
}

@@ -9,4 +9,2 @@ # @markuplint/i18n

Prerequisites: [Node.js](https://nodejs.org) (Version 12.4.0 or later)
```sh

@@ -24,4 +22,4 @@ $ npm install @markuplint/i18n

const t = translator({
locale: 'ja',
...require('@markuplint/i18n/locales/ja.json'),
locale: 'ja',
...require('@markuplint/i18n/locales/ja.json'),
});

@@ -41,27 +39,27 @@ ```

const message = t(
// Template #1
'{0} is {1:c}',
// The {0} value of template #1
t(
// Template #2
'{0} of {1}',
// The {0} value of template #2
t(
// Template #3
'the {0}',
// The {0} value of template #3
'value',
),
// The {1} value of template #2
t(
// Template #4
'the "{0*}" {1}',
// The {0} value of template #4
'id',
// The {1} value of template #4
'attribute',
),
),
// The {1} value of template #1
'duplicated',
// Template #1
'{0} is {1:c}',
// The {0} value of template #1
t(
// Template #2
'{0} of {1}',
// The {0} value of template #2
t(
// Template #3
'the {0}',
// The {0} value of template #3
'value',
),
// The {1} value of template #2
t(
// Template #4
'the "{0*}" {1}',
// The {0} value of template #4
'id',
// The {1} value of template #4
'attribute',
),
),
// The {1} value of template #1
'duplicated',
);

@@ -83,16 +81,20 @@

import { taggedTemplateTranslator } from '@markuplint/i18n';
const _ = taggedTemplateTranslator(ja);
const _ = taggedTemplateTranslator({
locale: 'ja',
...require('path/to/dictionary/ja.json'),
});
const message = _`${
//
_`${
//
_`the ${'value'}`
} of ${
//
_`the "${'id'}" ${'attribute'}`
}`
//
_`${
//
_`the ${'value'}`
} of ${
//
_`the "${'id'}" ${'attribute'}`
}`
} is ${
//
'c:duplicated'
//
'c:duplicated'
}`;

@@ -168,14 +170,1 @@

```
## Contributing
```
$ git clone git@github.com:markuplint/markuplint.git -b main
$ yarn
$ yarn build
$ yarn test
```
---
Copyright © 2021 markuplint. Under the MIT License.

Sorry, the diff of this file is not supported yet

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