Commit b2d7e3d3 authored by Dave Griffiths's avatar Dave Griffiths
Browse files

i18n working

parent 1e748f1e
......@@ -402,8 +402,6 @@
(define i18n-text
(msg 123)
(define (mtext-lookup id)
(define (_ l)
......@@ -412,7 +410,9 @@
(let ((translations (cadr (car l))))
(if (<= (length translations) i18n-lang)
(string-append (symbol->string id) " not translated")
(list-ref translations i18n-lang))))
(let ((r (list-ref translations i18n-lang)))
(if (or (equal? r "") (equal? r " "))
(list-ref translations 0) r)))))
(else (_ (cdr l)))))
(_ i18n-text))
......@@ -34,13 +34,27 @@
(setup db "stream")
db "local" "app-settings2" "null" 1
db "local" "app-settings" "null" 2
(ktv "user-id" "varchar" "No name yet...")
(ktv "language" "int" 0)
(ktv "house-count" "int" 0)
(ktv "photo-id-count" "int" 0)))
(define (get-setting-value name)
(ktv-get (get-entity db "local" 2) name))
(define (set-setting! key type value)
db "local" 2 (list (ktv key type value))))
(define (get/inc-setting key)
(let ((r (get-setting-value key)))
(set-setting! key "int" (+ r 1))
(set! i18n-lang (get-setting-value "language"))
(define entity-types (list "village" "household" "individual"))
;;(display (db-all db "local" "app-settings"))(newline)
......@@ -528,7 +542,15 @@
(mbutton-scale 'sync (lambda () (list (start-activity "sync" 0 "")))))
(mspinner 'languages (list 'english 'khasi 'hindi) (lambda (c) (list)))
(mspinner 'languages (list 'english 'khasi 'hindi)
(lambda (c)
(set-setting! "language" "int"
((equal? c "English") 0)
((equal? c "Khasi") 1)
((equal? c "Hindi") 2)))
(set! i18n-lang (get-setting-value "language"))
(mbutton-scale 'find-individual (lambda () (list (start-activity "individual-chooser" choose-code "")))))
db "sync" 'villages "village" "village" (lambda () #f)
......@@ -539,6 +561,8 @@
(activity-layout activity))
(lambda (activity arg)
(update-widget 'spinner (get-id "languages-spinner") 'selection
(get-setting-value "language"))
(gps-start "gps" (lambda (loc)
(set-current! 'location loc)
(list (toast (string-append
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment