Merge pull request #8 from status-im/feat/translation-package

feat: add function to change language on the engine
This commit is contained in:
Jonathan Rainville 2020-07-21 11:00:01 -04:00 committed by GitHub
commit 5befb45943
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -151,6 +151,7 @@ proc dos_qqmlapplicationengine_load_data(engine: DosQQmlApplicationEngine, data:
proc dos_qqmlapplicationengine_add_import_path(engine: DosQQmlApplicationEngine, path: cstring) {.cdecl, dynlib: dynLibName, importc.}
proc dos_qqmlapplicationengine_context(engine: DosQQmlApplicationEngine): DosQQmlContext {.cdecl, dynlib: dynLibName, importc.}
proc dos_qqmlapplicationengine_delete(engine: DosQQmlApplicationEngine) {.cdecl, dynlib: dynLibName, importc.}
proc dos_qapplication_load_translation(engine: DosQQmlApplicationEngine, content: cstring) {.cdecl, dynlib: dynLibName, importc.}
# QVariant
proc dos_qvariant_create(): DosQVariant {.cdecl, dynlib: dynLibName, importc.}

View File

@ -23,6 +23,9 @@ proc setRootContextProperty*(self: QQmlApplicationEngine, name: string, value: Q
let context = dos_qqmlapplicationengine_context(self.vptr)
dos_qqmlcontext_setcontextproperty(context, name.cstring, value.vptr)
proc setTranslationPackage*(self: QQmlApplicationEngine, packagePath: string) =
dos_qapplication_load_translation(self.vptr, packagePath.cstring)
proc delete*(self: QQmlApplicationEngine) =
## Delete the given QQmlApplicationEngine
debugMsg("QQmlApplicationEngine", "delete")