Socket
Socket
Sign inDemoInstall

cocorita

Package Overview
Dependencies
5
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "cocorita",
"version": "1.0.3",
"version": "1.0.4",
"description": "Cocorita Translations Library",

@@ -5,0 +5,0 @@ "main": "lib/cocorita.js",

@@ -8,3 +8,3 @@ # Cocorita language translation library

There are many great localization tools out there, if you need a fully customizable popular/standard solution then you should go for them.
But if you just need translation then Cocorita can fit your needs, it's small and functional. Give it a try!
If you just need translation then Cocorita can fit your needs, it's small and functional. Give it a try!

@@ -104,4 +104,23 @@ ## Usage

## Initialization
**DO NOT USE THIS FEATURE IN PRODUCTION.**
## Replace in translated string
Sometimes you need to translate a text which contains some dynamic sections you want to set at run time.
In these cases, you can format your texts as a template (Cocorita support Mustache style tags) and use the tr() function "translate" property option:
```javascript
tr('You have {{ msglen }} new messages and {{ reqlen }} new requests!', {
replace: {
msglen: messages.length,
reqlen: requests.length
}
});
```
translations database (YAML):
```yaml
You have {{ msglen }} new messages and {{ reqlen }} new requests!:
it: Hai {{ msglen }} nuovi messaggi e {{ reqlen }} nuove richieste!
```
## Database initialization
**THIS FEATURE IS NOT INTENDED TO BE USED IN PRODUCTION ENVIRONMENT**
Cocorita could initialize missing target translations for you.

@@ -108,0 +127,0 @@ To do so, you need to pass the 'initialize' languages array in the constructor options parameter:

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc