translates is simple language translate adapter it's can help me translate local language.
create csv file, add to ./examples/locale
create base.csv file respectively add in to ./examples/locale/zh and ./examples/locale/en PATH
./examples/locale/zh/base.csv file for example:
"hello";"你好"
"world";"世界"
"local";"本地化"
"game-start";"开始游戏"
./examples/locale/en/base.csv file for example:
"hello";"hello"
"world";"world"
"local";"localization"
"game-start";"game start"
In your program write:
(use-modules (translates translate))
(set-translate "csv" "./examples/locale" "zh" '((delimiter . #\;)))
TODO translate:
(translate 'hello) => "你好"
(translate 'world) => "世界"
;;; designated use language environment
(translate 'hello "en") => "hello"
(translate 'local "en") => "localization"
you need new create a scheme file.this file must be include a , must be Accept four parameters(keyword content local option), keyword is (translate key), content is language file PATH, local is locale, option is other option,
return (translate 'key) of result => value will this file move to ../translates/adapter PATH
This file looks like:
(define-module (translates adapter gettext)
#:use-module (translates utils)
#:export (get-translate-data))
(define (get-translate-data keyword content local option)
;;; TODO
)
Please reader test.scm