Loading .gitignore +1 −0 Original line number Diff line number Diff line /content_html /templates /autoroute /locales /package .max .idea Loading Makefile +2 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ demo: ## Installation d'une édition de démo cp -r .max/fixtures/templates .;\ cp -r .max/fixtures/autoroute .;\ cp -r .max/fixtures/config.xml .;\ cp -r .max/fixtures/locales .;\ echo 'demo installée.';\ fi .PHONY: demo Loading Loading @@ -106,6 +107,7 @@ clean: ## Supprime l'installation de MaX et les fichiers du projet rm -rf content_html;\ rm -rf templates;\ rm -rf autoroute;\ rm -rf locales;\ rm config.xml;\ rm -rf .max;\ else\ Loading fixtures/locales/fr.json 0 → 100644 +3 −0 Original line number Diff line number Diff line { "tdm": "Sommaire" } No newline at end of file src/main/core/i18n.xqm +4 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,8 @@ import module namespace utils = 'https://certic.unicaen.fr/max/utils' at 'utils. declare function i18n:translate ($key as xs:string, $lang as xs:string) as xs:string { try { let $translations := json:doc(i18n:getUserLocalesPath() || $lang || '.json') return string(($translations/json/*[local-name(.)=$key])[1]/text()) let $translation := string(($translations/json/*[local-name(.)=$key])[1]/text()) return if($translation = '') then i18n:default-translate($key, $lang) else $translation }catch * {i18n:default-translate($key, $lang)} }; Loading @@ -28,7 +29,8 @@ declare function i18n:translate ($key as xs:string, $lang as xs:string) as xs:st declare function i18n:default-translate ($key as xs:string, $lang as xs:string) as xs:string { try { let $translations := json:doc(i18n:getVocabularyLocalesPath() || $lang || '.json') return string(($translations/json/*[local-name(.)=$key])[1]/text()) let $translation := string(($translations/json/*[local-name(.)=$key])[1]/text()) return if($translation = '') then $key else $translation }catch * {$key} }; Loading Loading
.gitignore +1 −0 Original line number Diff line number Diff line /content_html /templates /autoroute /locales /package .max .idea Loading
Makefile +2 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ demo: ## Installation d'une édition de démo cp -r .max/fixtures/templates .;\ cp -r .max/fixtures/autoroute .;\ cp -r .max/fixtures/config.xml .;\ cp -r .max/fixtures/locales .;\ echo 'demo installée.';\ fi .PHONY: demo Loading Loading @@ -106,6 +107,7 @@ clean: ## Supprime l'installation de MaX et les fichiers du projet rm -rf content_html;\ rm -rf templates;\ rm -rf autoroute;\ rm -rf locales;\ rm config.xml;\ rm -rf .max;\ else\ Loading
fixtures/locales/fr.json 0 → 100644 +3 −0 Original line number Diff line number Diff line { "tdm": "Sommaire" } No newline at end of file
src/main/core/i18n.xqm +4 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,8 @@ import module namespace utils = 'https://certic.unicaen.fr/max/utils' at 'utils. declare function i18n:translate ($key as xs:string, $lang as xs:string) as xs:string { try { let $translations := json:doc(i18n:getUserLocalesPath() || $lang || '.json') return string(($translations/json/*[local-name(.)=$key])[1]/text()) let $translation := string(($translations/json/*[local-name(.)=$key])[1]/text()) return if($translation = '') then i18n:default-translate($key, $lang) else $translation }catch * {i18n:default-translate($key, $lang)} }; Loading @@ -28,7 +29,8 @@ declare function i18n:translate ($key as xs:string, $lang as xs:string) as xs:st declare function i18n:default-translate ($key as xs:string, $lang as xs:string) as xs:string { try { let $translations := json:doc(i18n:getVocabularyLocalesPath() || $lang || '.json') return string(($translations/json/*[local-name(.)=$key])[1]/text()) let $translation := string(($translations/json/*[local-name(.)=$key])[1]/text()) return if($translation = '') then $key else $translation }catch * {$key} }; Loading