mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 23:59:41 +02:00
Runtime translation for 3rd party Nyquist plug-ins
3rd party plug-ins may provide their own translations for runtime messages (return strings and debug messages).
This commit is contained in:
parent
705fc96208
commit
504cf0fe85
@ -6,3 +6,40 @@
|
||||
|
||||
; (load "test.lsp")
|
||||
|
||||
|
||||
|
||||
;; "_" (UNDERSCORE) - translation function
|
||||
;;
|
||||
;; Third party plug-ins are not translated by gettext in Audacity, but may include a
|
||||
;; list of translations named *local*. The format of *locale* must be:
|
||||
;; (LIST (language-list) [(language-list) ...])
|
||||
;; Each language-list is an a-list in the form:
|
||||
;; ("cc" ((list "string" "translated-string") [(list "string" "translated-string") ...]))
|
||||
;; where "cc" is the quoted country code.
|
||||
;;
|
||||
(setf underscore (function _))
|
||||
;;
|
||||
(defun _(txt)
|
||||
(setf translated nil)
|
||||
(when (boundp '*locale*)
|
||||
(if (not (listp *locale*))
|
||||
(format t "Warning: Invalid *locale* (not a list).~%")
|
||||
(let ((locale (get '*audacity* 'language)))
|
||||
(if (not (setf language-list (assoc locale *locale* :test 'string-equal)))
|
||||
(format t "Warning: No language-list for \"~a\" in *locale*.~%" locale)
|
||||
(if (/= (length language-list) 2)
|
||||
(format t "Error: Invalid \"~a\" language list in *locale*.~%" locale)
|
||||
; Get just the list of substitution pairs
|
||||
(let ((language-list (second language-list)))
|
||||
(if (not (listp language-list))
|
||||
(format t "Warning: No translations for \"~a\" in *locale*.~%" locale)
|
||||
(let ((translation (assoc txt language-list :test 'string=)))
|
||||
(if (not translation)
|
||||
(format t "Warning: No ~a translations for \"~a\".~%" locale txt)
|
||||
(if (not (and (listp translation)
|
||||
(= (length translation) 2)))
|
||||
(format t "Error: Invalid translation for ~a in *locale*.~%" txt)
|
||||
(setf translated (second translation))))))))))))
|
||||
(if translated
|
||||
translated
|
||||
(funcall underscore txt)))
|
||||
|
@ -626,6 +626,10 @@ bool NyquistEffect::Process()
|
||||
mProps = wxEmptyString;
|
||||
|
||||
mProps += wxString::Format(wxT("(putprop '*AUDACITY* (list %d %d %d) 'VERSION)\n"), AUDACITY_VERSION, AUDACITY_RELEASE, AUDACITY_REVISION);
|
||||
// TODO: Document.
|
||||
wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
|
||||
lang = (lang == wxEmptyString)? wxGetApp().InitLang(lang) : lang;
|
||||
mProps += wxString::Format(wxT("(putprop '*AUDACITY* \"%s\" 'LANGUAGE)\n"), lang);
|
||||
|
||||
mProps += wxString::Format(wxT("(setf *DECIMAL-SEPARATOR* #\\%c)\n"), wxNumberFormatter::GetDecimalSeparator());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user