Skip to content

markdown-localization/mdlm-sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub release (latest SemVer) lint unit-tests CII Best Practices

Markdown Localization Manager

Minimal reference implenentation of Markdown Localization Specification

mdlm demo

Installing and Updating

To install or update mdlm, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL for Bash:

curl -o- https://raw.githubusercontent.com/markdown-localization/mdlm-sh/v0.0.20/install.sh | bash

Or zsh:

curl -o- https://raw.githubusercontent.com/markdown-localization/mdlm-sh/v0.0.20/install.sh | zsh

Running either of the above commands downloads a script and runs it. The script copies mdlm script to ~/.mdlm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.bashrc or ~/.zshrc).

export MDLM_DIR="$HOME/.mdlm"
alias mdlm='$MDLM_DIR/mdlm.sh'

Usage

List all supported locales

$ mdlm search
aa (Afaraf) - Afar
ab (Аҧсуа) - Abkhazian
ae (Avesta) - Avestan
af (Afrikaans) - Afrikaans
ak (Akan) - Akan
am (አማርኛ) - Amharic
an (Aragonés) - Aragonese
ar (العَرَبِيَّة) - Arabic
as (অসমীয়া) - Assamese
av (Авар) - Avaric

List supported locales matching a specific pattern

$ mdlm search uz
uz (Ўзбек) Uzbek
uz-Cyrl (Ўзбек) Uzbek in Cyrillic script
uz-Latn (O‘zbekcha) Uzbek in Latin script

Add a new locale

$ mdlm add eo
Creating new localization files for locale - "eo (Esperanto) - Esperanto":
Creating example/README-eo.md. Confirm? [Y/n]
- Created.
Creating README-eo.md. Confirm? [Y/n]
- Created.
Finished. Total files created: 2

As a result, new README-eo.md file will be created. Localization switcher header will be added to original and localized files.

Remove a locale

$ mdlm rm eo --yes
Removing localization files for locale - "eo (Esperanto) - Esperanto":
Removing README-eo.md.
- Removed.
Removing example/README-eo.md.
- Removed.
Localization files removed.

As a result, README-eo.md will be removed. Localization switcher header will be updated, or removed, if no other localizations available. Optional --yes automatically sets yes to all prompts.

Check synchronization status

$ mdlm status
Localization status for all locales.
example/README.md (English):
* example/README-ru.md (Русский) - synced.
* example/README-ar.md (العَرَبِيَّة) - synced.
* example/README-zh-Hans.md (简体中文) - synced.
* example/README-es.md (Español) - outdated.
* example/README-fr.md (Français) - synced.
README.md (English):
* README-ru.md (Русский) - synced.

Get synchronization diff

Locale argument is optional.

$ mdlm diff es
Localization status for: es (Español) - Spanish.
- example/README-es.md (Español) - outdated.
5c4,5
< Here is an outdated text of example.
---
> Here is a text of example.
>

Contributing

See CONTRIBUTING.md

Credits

Special thanks to nvm-sh/nvm for inpsiration and specifics.