Last active
August 29, 2015 14:25
-
-
Save pavlin-policar/6715de793b4529458268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Moodle prepend lang tags where any translations are needed. | |
Long syntax: | |
Find: | |
(<span lang="es") | |
Replace: | |
<span lang="en" class="multilang"> English version<\/span><span lang="sl" class="multilang"> Slovenska verzija<\/span>$1 | |
Short syntax: | |
Find: | |
(\{mlang es\}) | |
Replace: | |
\{mlang en\} English version\{mlang\}\{mlang sl\} Slovenska verzija\{mlang\}$1 | |
Moodle yes/no cloze question replace regex (see UNIT 3: Real numbers ex.2 as an example). | |
Find: | |
\{1:MC:(=)?Si~(=)?No\} | |
Replace: | |
\{1:MC:$1\{mlang en\\\}Yes\{mlang\\\}\{mlang sl\\\}Da\{mlang\\\}~$2\{mlang en\\\}No\{mlang\\\}\{mlang sl\\\}Ne\{mlang\\\}\} | |
Moodle yes/no questions already translated using above transform and change with shorter language syntax. | |
E.g. | |
<span lang="en" class="multilang">Yes</span> | |
-> (regular, works only with simple tags, DON'T run this on a whole document, as nested html elements will mess it up) | |
{mlang en}Yes{mlang} | |
-> (where closing curly brace must be escaped e.g. cloze question type) | |
{mlang en\}Yes{mlang\} | |
Find: | |
<span lang="(\w{2})" class="multilang">(\w+)<\/span> | |
Replace (regular, works only with simple tags, DON'T run this on a whole document, as nested html elements will mess it up): | |
\{mlang $1\}$2\{mlang\} | |
Replace (where closing curly brace must be escaped): | |
\{mlang $1\\\}$2\{mlang\\\} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment