add i18n (requires installation from scratch of all existing examples)

This commit is contained in:
pls.153 2022-04-29 12:07:13 +02:00
parent ee69ed7c32
commit b4f2700ddc
16 changed files with 98 additions and 11 deletions

View file

@ -7,7 +7,7 @@
#include <QQuickView>
#include <QDebug>
const char LQML::version[] = "22.4.3"; // Apr 2022
const char LQML::version[] = "22.5.1"; // May 2022
extern "C" void ini_LQML(cl_object);

View file

@ -8,6 +8,7 @@
#include <QQmlEngine>
#include <QQmlFileSelector>
#include <QQuickView>
#include <QTranslator>
#include <QtDebug>
#include <iostream>
@ -95,6 +96,11 @@ int main(int argc, char* argv[]) {
exit(0);
}
QTranslator translator;
if (translator.load(QLocale(), QString(), QString(), ":/i18n")) {
QCoreApplication::installTranslator(&translator);
}
new QQmlFileSelector(view.engine(), &view);
QString qml("qml/main.qml");
QUrl url;

View file

@ -5,16 +5,19 @@
(defparameter *sources* (make-hash-table :test 'equal))
(progn
(when (probe-file "tr.h")
(delete-file "tr.h"))
(defvar cl-user::*tr-path* *default-pathname-defaults*)
(let ((tr.h (merge-pathnames "tr.h" cl-user::*tr-path*)))
(when (probe-file tr.h)
(delete-file tr.h))
(format t "~&creating ~S~%" tr.h)
(define-compiler-macro tr (&whole form src &optional con (n -1))
(let* ((source (ignore-errors (eval src)))
(context* (ignore-errors (eval con)))
(context (if (stringp context*)
context*
(file-namestring *compile-file-truename*))))
(with-open-file (out "tr.h" :direction :output :if-exists :append :if-does-not-exist :create)
(with-open-file (out tr.h :direction :output :if-exists :append :if-does-not-exist :create)
(if (stringp source)
(unless (gethash (cons source context) *sources*)
(setf (gethash (cons source context) *sources*) t)