Permalink
Browse files

[translations] try to handle missing messages better

use English messages as a default and override with language specific
items.  That way these should be no empty messages on the display.

Signed-off-by: Christopher Hall <hsw@openmoko.com>
  • Loading branch information...
1 parent 5fed4b6 commit 6222dc9f3630915144a5b3469289305738cea47a @hxw hxw committed Dec 8, 2011
Showing with 34 additions and 16 deletions.
  1. +1 −0 Makefile
  2. +1 −0 XML-Licenses/sv/wiki.nls
  3. +1 −0 XML-Licenses/wiki.inf
  4. +31 −16 samo-lib/scripts/nls-installer
View
@@ -785,6 +785,7 @@ nls-install: validate-destdir
--language="$${language}" \
--suffix="$${suffix}" \
--output="wiki.nls" \
+ --base="${LICENSE_DIR}/en/wiki.nls" \
--nls="$${src}" \
--change="$${native_name}" \
--verbose ; \
@@ -2,6 +2,7 @@
# Exported from translatewiki.net
# Author: Ainali
+wiki_name=Svenska Wikipedia
type_a_word=Skriv ett ord eller en fras
searching=söker...
select_wiki=Välj encyklopedi
@@ -57,6 +57,7 @@
, pt, ptpedia,
, ru, rupedia,
, sr, srpedia,
+ , sv, svpedia,
, simple, e0pedia,
, tr, trpedia,
, zhs, zhpedia, CHINESE-PINYIN
@@ -49,6 +49,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$0" "$@"
(format #t " --language=<lang> -l <lang> language code~%")
(format #t " --suffix=<suffix> -s <suffix> suffix (pedia,quote,dict,...)~%")
(format #t " --output=<file> -o <file> output file name e.g. wiki.nls~%")
+ (format #t " --base=<file> -b <file> defaults that nls file will override~%")
(format #t " --nls=<file> -n <file> nls source file~%")
(format #t " --change=<name> -c <name> optional s/English/<name>/g~%")
(exit 1))
@@ -63,6 +64,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$0" "$@"
(language (single-char #\l) (value #t))
(suffix (single-char #\s) (value #t))
(output (single-char #\o) (value #t))
+ (base (single-char #\b) (value #t))
(nls (single-char #\n) (value #t))
(change (single-char #\c) (value #t))
(verbose (single-char #\v))
@@ -71,6 +73,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$0" "$@"
(=l (option-ref parsed-opts 'language #f))
(=s (option-ref parsed-opts 'suffix #f))
(=o (option-ref parsed-opts 'output #f))
+ (=b (option-ref parsed-opts 'base #f))
(=n (option-ref parsed-opts 'nls #f))
(=c (option-ref parsed-opts 'change ""))
(*verbose* (option-ref parsed-opts 'verbose #f))
@@ -84,6 +87,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$0" "$@"
(unless =l (usage "Missing language"))
(unless =s (usage "Missing suffix"))
(unless =o (usage "Missing output"))
+ (unless =b (usage "Missing base"))
(unless =n (usage "Missing nls"))
(if *debug*
@@ -94,23 +98,34 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$0" "$@"
(defaults (make-hash-table 100)))
(if *verbose*
(format #t "creating: ~a~%" out))
- (with-input-from-file =n
+ (with-output-to-file out
(lambda ()
- (with-output-to-file out
- (lambda ()
- (let* ((ignored (make-regexp "^[[:space:]]*(#\\*.*)?$"))
- (comment (make-regexp "^[[:space:]]*#.*$"))
- (special (make-regexp "^[[:space:]]*([[:alnum:]_]+)[[:space:]]*:[[:space:]]*([[:alnum:]_]+)[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$"))
- (normal (make-regexp "^[[:space:]]*([[:alnum:]_]+)[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$"))
- (control-list
- (list (list no-op ignored)
- (list write-all comment)
- (list (lambda (match) (write-match table match 1 =s 2 3)) special)
- (list (lambda (match) (write-var defaults match 1 2)) normal)
- )))
+ (let* ((ignored (make-regexp "^[[:space:]]*(#\\*.*)?$"))
+ (comment (make-regexp "^[[:space:]]*#.*$"))
+ (special (make-regexp "^[[:space:]]*([[:alnum:]_]+)[[:space:]]*:[[:space:]]*([[:alnum:]_]+)[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$"))
+ (normal (make-regexp "^[[:space:]]*([[:alnum:]_]+)[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$"))
+ (control-list-normal
+ (list (list no-op ignored)
+ (list write-all comment)
+ (list (lambda (match) (write-match table match 1 =s 2 3)) special)
+ (list (lambda (match) (write-var defaults match 1 2)) normal)
+ ))
+ (control-list-defaults
+ (list (list no-op ignored)
+ (list no-op comment)
+ (list no-op special)
+ (list (lambda (match) (write-var defaults match 1 2)) normal)
+ )))
+ (with-input-from-file =n
+ (lambda ()
(while (not (eof-object? (peek-char)))
- (process control-list
- (string-trim-both (read-line)))))
+ (process control-list-normal
+ (string-trim-both (read-line))))))
+ (with-input-from-file =b
+ (lambda ()
+ (while (not (eof-object? (peek-char)))
+ (process control-list-defaults
+ (string-trim-both (read-line)))))))
;; copy in any missing values from defaults
(hash-for-each (lambda (key data)
@@ -120,7 +135,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$0" "$@"
(for-each display
(sort-list
(hash-map->list (lambda (key data)
- (format #f "~a=~a~%" key (change =c data))) table) string<?)))))))))
+ (format #f "~a=~a~%" key (change =c data))) table) string<?)))))))

0 comments on commit 6222dc9

Please sign in to comment.