Installations
npm install node-gettext-sprintf
Releases
Unable to fetch releases
Developer
Mindflash
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
NPM Version
1.4.21
Statistics
24 Commits
1 Forks
42 Watching
2 Branches
17 Contributors
Updated on 02 Mar 2017
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
23,642
Last day
150%
5
Compared to previous day
Last week
-40.6%
19
Compared to previous week
Last month
58%
188
Compared to previous month
Last year
47.4%
1,209
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
1
#node-gettext-sprintf
A combination of node-gettext and sprintf
Installation:
npm install node-gettext-sprintf
Usage:
1"use strict"; 2var fs = require('fs'); 3var getText = require('node-gettext-sprintf'); 4 5// setup the 'test' language 6var getText = getText({ 7 'test': fs.readFileSync('./test.po') 8}); 9 10/* 11Given a PO in this form: 12 13msgid "" 14msgstr "" 15"Language: test0" 16"MIME-Version: 1.0" 17"Content-Type: text/plain; charset=UTF-8" 18"Content-Transfer-Encoding: 8bit" 19"Plural-Forms: nplurals=2; plural=(n != 1);" 20 21msgid "Simple string" 22msgstr "Simple string translated" 23 24msgid "1 string, 1 int place-holder: %s, %d" 25msgstr "1 string, 1 int place-holder: %s, %d translated" 26 27msgid "Simple string singular" 28msgstr[0] "Simple string translated" 29msgstr[1] "Simple string translated plural" 30 31msgid "Simple string singular int place-holder: %d" 32msgstr[0] "Simple string translated int place-holder: %d" 33msgstr[1] "Simple string translated plural int place-holder: %d" 34 35msgctxt "Test Context" 36msgid "Simple string in context" 37msgstr "Simple string in context translated" 38 39msgctxt "Test Context" 40msgid "Simple string singular in context int place-holder: %d" 41msgstr[0] "Simple string in context translated int place-holder: %d" 42msgstr[1] "Simple string in context translated plural int place-holder: %d" 43*/ 44 45// load the 'test' language 46languageFns = getText('test'); 47 48languageFns.getSingularText("Simple string"); 49// returns "Simple string translated" 50 51languageFns.getSingularText("1 string, 1 int place-holder: %s, %d", "test-string", 30); 52// returns "1 string, 1 int place-holder: test-string, 30 translated" 53 54languageFns.getSingularOrPluralText("Simple string singular", 2); 55// returns "Simple string translated plural" 56 57languageFns.getSingularOrPluralText("Simple string singular int place-holder: %d", 2, 20); 58// returns "Simple string translated plural int place-holder: 20" 59 60languageFns.getSingularTextInContext("Test Context", "Simple string in context") 61// returns "Simple string in context translated" 62 63fns.getSingularOrPluralTextInContext("Test Context", "Simple string singular in context int place-holder: %d", 2, 20), 64// returns "Simple string in context translated plural int place-holder: 20"
The following standard gettext methods are also supported:
dgettext (getSingularText)
dpgettext (getSingularTextInContext)
dngettext (getSingularOrPluralText)
dnpgettext (getSingularOrPluralTextInContext)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
Found 0/24 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Score
3
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More