🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

multilang

Package Overview
Dependencies
Maintainers
7
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multilang

Tools for multilanguage and Markdown multilang

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
7
Created
Source

multilang

Tools for multilanguage & Markdown multilang

npm-version downloads build coverage

language: English also available in: Spanish - German

In a Markdown or HTML-like file is written the documentation in multiple languages.

One of these languages ​​is the main, the others are commented with open and close

Then with multilang the other languages ​​are extracted to generate one file for each of the other languages ​​defined

Install

$ npm install multilang -g

How to use

$ multilang doc-en.md

A .md file is generated for the other languages written in doc-en.md file

Multilanguage document format

Any HTML or Markdown document is a multilenguage document if it has a main multilanguage directive.

Example

<!--multilang v0 en:README.md es:LEEME.md fr:LISEZMOI.md de:LIESMICH.md -->
<!--multilang buttons-->

language: ![English](https://raw.githubusercontent.com/codenautas/multilang/master/img/lang-en.png)
also available in:
[Spanish](LEEME.md)  [French](LISEZMOI.md)  [German](LIESMICH.md)

<!--lang:en-->
This is a little example
<!--lang:es--]
Este es un pequeño ejemplo
[!--lang:fr--]
Ce est un petit exemple
[!--lang:de--]
Das ist ein Beispiel
[!--lang:*-->

<!--lang:en-->
"*" means all languages
<!--lang:es--]
"*" es para indicar todos los idiomas
[!--lang:fr--]
"*" est d'indiquer toutes les langues
[!--lang:de--]
"*" steht für alle Sprachen
[!--lang:*-->
All you need is multilang!

In this example:

<!--multilanguage v0 en:README.md es:LEEME.md fr:LISEZMOI.md-->

is the directive for declare the languages

<!--multilanguage buttons-->

is the directive for declaring the place for the button section

[!--lang:fr--]

is the directive for declaring the language of the next section (use * for all languages)

API


var fs = require('fs');
var multilang = require('multilang');

var englishText = fs.readFileSync('README.md', {encoding:'utf8'});

var warnings = multilang.getWarnings(englishText);
if(warnings.lengt){
    console.log('WARN', warnings);
}

var spanishText = multilang.changeDoc(englishText,'es');

console.log('spanish.md',spanishText);

(note about the example: do not use Sync functions in production, use async or promise version as you can see in codenautas

functionuse
changeDoc(text,lang)receives a multilang text and a language code and returns de text of specified lang
warnings(text)receives a list of warnings and returns a multilang text

License

MIT

...................................

FAQs

Package last updated on 24 Jul 2022

Did you know?

Socket

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.

Install

Related posts