Skip to content

Commit

Permalink
Merge pull request #17 from voitau/master
Browse files Browse the repository at this point in the history
Rename @l10n annotations to l10n
  • Loading branch information
voitau authored Apr 3, 2020
2 parents 945ea63 + e853e32 commit 7c3ec6c
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 61 deletions.
23 changes: 15 additions & 8 deletions mdlm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ MDLM_VERSION="0.0.14"

DEFAULT_LCM_LOCAL="English"

MDLM_HEADER="<!-- @l10n:h -->"
MDLM_P_OPEN="<!-- @l10n:p"
MDLM_P_CLOSE="@l10n:p -->"
MDLM_HEADER="<!-- l10n:select -->"

MDLM_SECTION_OPEN="<!-- l10n:section"
MDLM_SECTION_CLOSE="l10n:section -->"
MDLM_P_TBD="TBD"
MDLM_IGNORE_START="<!-- @l10n:ignore start -->"
MDLM_IGNORE_END="<!-- @l10n:ignore end -->"

MDLM_IGNORE_START="<!-- l10n:ignore start -->"
MDLM_IGNORE_END="<!-- l10n:ignore end -->"

MDLM_ADD_LINK="https://github.com/markdown-localization/markdown-localization-spec#workflow"

Expand Down Expand Up @@ -128,7 +130,7 @@ mdlm_copy_original_to_localized_file() {
command echo "${HEADER}" > "${LCM_FILE}"
command grep -v "${MDLM_HEADER}" "${ORIG_FILE}" \
| sed -e "/$MDLM_IGNORE_START/,/$MDLM_IGNORE_END/d" \
| awk -v RS="(^|\n)#" -v popen="${MDLM_P_OPEN}" -v pclose="${MDLM_P_CLOSE}" -v ptbd="${MDLM_P_TBD}" \
| awk -v RS="(^|\n)#" -v popen="${MDLM_SECTION_OPEN}" -v pclose="${MDLM_SECTION_CLOSE}" -v ptbd="${MDLM_P_TBD}" \
'{ if ($0) print popen "\n#" $0 pclose "\n" ptbd "\n"}' >> "${LCM_FILE}"
}

Expand Down Expand Up @@ -282,8 +284,13 @@ mdlm_update_all_headers() {
mdlm_original_diff() {
diff --color="${USE_COLORS}" -B \
<(grep -v "${MDLM_HEADER}" "${2}" \
| sed -e "/${MDLM_P_CLOSE}/,/${MDLM_P_OPEN}/d" -e "/${MDLM_P_OPEN}/d" -e "/$MDLM_IGNORE_START/,/$MDLM_IGNORE_END/d") \
<(grep -v "${MDLM_HEADER}" "${1}" | sed -e "/${MDLM_IGNORE_START}/,/${MDLM_IGNORE_END}/d")
| sed \
-e "/${MDLM_SECTION_CLOSE}/,/${MDLM_SECTION_OPEN}/d" \
-e "/${MDLM_SECTION_OPEN}/d" \
-e "/$MDLM_IGNORE_START/,/$MDLM_IGNORE_END/d") \
<(grep -v "${MDLM_HEADER}" "${1}" \
| sed \
-e "/${MDLM_IGNORE_START}/,/${MDLM_IGNORE_END}/d")
}

mdlm_get_file_localizations() {
Expand Down
14 changes: 7 additions & 7 deletions test/example-localized/README-ar.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[English](README.md) | [Русский](README-ru.md) | **[العَرَبِيَّة](README-ar.md)** | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
[English](README.md) | [Русский](README-ru.md) | **[العَرَبِيَّة](README-ar.md)** | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->

<!-- @l10n:ignore start -->
<!-- l10n:ignore start -->
![l10n-sync-ar](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-ar/badge.svg)
<!-- @l10n:ignore end -->
<!-- l10n:ignore end -->

<!-- @l10n:p
<!-- l10n:section
## Example A
Here is a text of example.
@l10n:p -->
l10n:section -->
## المثال أ

هنا نص المثال. ترجم مع ترجمة جوجل.

<!-- @l10n:p
<!-- l10n:section
### References
Some references here.
@l10n:p -->
l10n:section -->
### المراجع

بعض المراجع هنا.
14 changes: 7 additions & 7 deletions test/example-localized/README-es.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | **[Español](README-es.md)** | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | **[Español](README-es.md)** | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->

<!-- @l10n:ignore start -->
<!-- l10n:ignore start -->
![l10n-sync-es](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-es/badge.svg)
<!-- @l10n:ignore end -->
<!-- l10n:ignore end -->

<!-- @l10n:p
<!-- l10n:section
## Example A
Here is an outdated text of example.
@l10n:p -->
l10n:section -->
## Ejemplo A

Aquí hay un texto de ejemplo. Traducido con Google Translate.

<!-- @l10n:p
<!-- l10n:section
### References
Some references here.
@l10n:p -->
l10n:section -->
### Referencias

Algunas referencias aquí.
14 changes: 7 additions & 7 deletions test/example-localized/README-fr.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | **[Français](README-fr.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | **[Français](README-fr.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->

<!-- @l10n:ignore start -->
<!-- l10n:ignore start -->
![l10n-sync-fr](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-fr/badge.svg)
<!-- @l10n:ignore end -->
<!-- l10n:ignore end -->

<!-- @l10n:p
<!-- l10n:section
## Example A
Here is a text of example.
@l10n:p -->
l10n:section -->
## Exemple A

Voici un texte d'exemple. Traduit avec Google Translate.

<!-- @l10n:p
<!-- l10n:section
### References
Some references here.
@l10n:p -->
l10n:section -->
### Les références

Quelques références ici.
14 changes: 7 additions & 7 deletions test/example-localized/README-ru.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[English](README.md) | **[Русский](README-ru.md)** | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
[English](README.md) | **[Русский](README-ru.md)** | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->

<!-- @l10n:ignore start -->
<!-- l10n:ignore start -->
![l10n-sync-ru](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-ru/badge.svg)
<!-- @l10n:ignore end -->
<!-- l10n:ignore end -->

<!-- @l10n:p
<!-- l10n:section
## Example A
Here is a text of example.
@l10n:p -->
l10n:section -->
## Пример А

Здесь находится текст примера.

<!-- @l10n:p
<!-- l10n:section
### References
Some references here.
@l10n:p -->
l10n:section -->

### Ссылки

Expand Down
14 changes: 7 additions & 7 deletions test/example-localized/README-zh-Hans.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | **[简体中文](README-zh-Hans.md)** | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | **[简体中文](README-zh-Hans.md)** | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->

<!-- @l10n:ignore start -->
<!-- l10n:ignore start -->
![l10n-sync-zh-Hans](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-zh-Hans/badge.svg)
<!-- @l10n:ignore end -->
<!-- l10n:ignore end -->

<!-- @l10n:p
<!-- l10n:section
## Example A
Here is a text of example.
@l10n:p -->
l10n:section -->
## 示例A

这是一个示例文本。 用Google翻译翻译。

<!-- @l10n:p
<!-- l10n:section
### References
Some references here.
@l10n:p -->
l10n:section -->
### 参考

这里有一些参考。
2 changes: 1 addition & 1 deletion test/example-localized/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**[English](README.md)** | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
**[English](README.md)** | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->

## Example A

Expand Down
10 changes: 5 additions & 5 deletions test/example-original/README-fr.md.en-it-fr.expected
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[English](README.md) | **[Français](README-fr.md)** | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
<!-- @l10n:p
[English](README.md) | **[Français](README-fr.md)** | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->
<!-- l10n:section
## Example A

Here is a text of example.
@l10n:p -->
l10n:section -->
TBD

<!-- @l10n:p
<!-- l10n:section
### References

Some references here.
@l10n:p -->
l10n:section -->
TBD

10 changes: 5 additions & 5 deletions test/example-original/README-it.md.en-it-fr.expected
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[English](README.md) | [Français](README-fr.md) | **[Italiano](README-it.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
[English](README.md) | [Français](README-fr.md) | **[Italiano](README-it.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->

<!-- @l10n:p
<!-- l10n:section
## Example A

Here is a text of example.
@l10n:p -->
l10n:section -->
TBD

<!-- @l10n:p
<!-- l10n:section
### References

Some references here.
@l10n:p -->
l10n:section -->
TBD

10 changes: 5 additions & 5 deletions test/example-original/README-it.md.en-it.expected
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[English](README.md) | **[Italiano](README-it.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
[English](README.md) | **[Italiano](README-it.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->

<!-- @l10n:p
<!-- l10n:section
## Example A

Here is a text of example.
@l10n:p -->
l10n:section -->
TBD

<!-- @l10n:p
<!-- l10n:section
### References

Some references here.
@l10n:p -->
l10n:section -->
TBD

2 changes: 1 addition & 1 deletion test/example-original/README.md.en-it-fr.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**[English](README.md)** | [Français](README-fr.md) | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
**[English](README.md)** | [Français](README-fr.md) | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->
## Example A

Here is a text of example.
Expand Down
2 changes: 1 addition & 1 deletion test/example-original/README.md.en-it.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**[English](README.md)** | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- @l10n:h -->
**[English](README.md)** | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* <!-- l10n:select -->
## Example A

Here is a text of example.
Expand Down

0 comments on commit 7c3ec6c

Please sign in to comment.