@@ -393,3 +393,47 @@ task syncNativeArtifacts {
393393}
394394
395395preBuild. dependsOn syncNativeArtifacts
396+
397+ // ---- ADFA-4593: tooltip three-tier help database ------------------------------
398+ // Source of truth is tools/help/i18n (.pot + <lang>.po compiled to assets/help.db).
399+ // Requires Python + polib for validation/compilation; if Python is absent the
400+ // committed help.db is used and checks are skipped (so local builds never break).
401+ def helpI18nDir = file(" tools/help/i18n" )
402+ def helpDb = file(" src/main/assets/help.db" )
403+ def helpRequiredLangs = " es,fr,hi,pt,ru"
404+ def helpPython = (System . getProperty(" os.name" ). toLowerCase(). contains(" win" )
405+ ? [" py" , " python" , " python3" ] : [" python3" , " python" ]). find { name ->
406+ try { def p = " ${ name} --version" . execute(); p. waitFor(); p. exitValue() == 0 }
407+ catch (ignored) { false }
408+ }
409+
410+ if (helpPython == null ) {
411+ logger. warn(" ADFA-4593: Python not found; using committed help.db and skipping tooltip "
412+ + " translation checks. Install Python + polib for full enforcement (required in CI)." )
413+ } else {
414+ tasks. register(" validateHelpTranslations" , Exec ) {
415+ group = " help"
416+ description = " Fail the build if required tooltip translations are missing."
417+ inputs. dir helpI18nDir
418+ workingDir projectDir
419+ def allowMissing = project. hasProperty(" helpAllowMissing" ) ? project. property(" helpAllowMissing" ) : " false"
420+ commandLine helpPython, " tools/help/validate_help.py" , " tools/help/i18n" ,
421+ " --required" , helpRequiredLangs, " --allow-missing" , allowMissing
422+ }
423+ tasks. register(" buildHelpDb" , Exec ) {
424+ group = " help"
425+ description = " Compile the tooltip help.db from .po sources."
426+ inputs. dir helpI18nDir
427+ outputs. file helpDb
428+ dependsOn " validateHelpTranslations"
429+ workingDir projectDir
430+ commandLine helpPython, " tools/help/build_help_db.py" , " tools/help/i18n" , helpDb. absolutePath
431+ }
432+ tasks. register(" extractHelpPot" , Exec ) {
433+ group = " help"
434+ description = " Regenerate strings.pot from the English source (run on demand)."
435+ workingDir projectDir
436+ commandLine helpPython, " tools/help/extract_help_pot.py" , " tools/help/i18n"
437+ }
438+ tasks. matching { it. name == " preBuild" }. configureEach { dependsOn " buildHelpDb" }
439+ }
0 commit comments