feat(client): also fix translations

This commit is contained in:
perf3ct 2025-06-11 14:13:59 +00:00
parent 23ce896681
commit 3041af7fe2
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
2 changed files with 42 additions and 29 deletions

View File

@ -1918,5 +1918,14 @@
"title": "Appearance",
"word_wrapping": "Word wrapping",
"color-scheme": "Color scheme"
},
"rosetta_warning": {
"title": "Performance Warning: Running Under Rosetta 2",
"message": "TriliumNext is currently running under Rosetta 2 translation, which means you're using the Intel (x64) version on an Apple Silicon Mac.",
"performance_impact": "This will significantly impact performance and battery life.",
"recommendation": "For the best experience, please download the native Apple Silicon (ARM64) version of TriliumNext from our releases page.",
"download_link": "Download Native Version",
"continue_anyway": "Continue Anyway",
"dont_show_again": "Don't show this warning again"
}
}

View File

@ -1,6 +1,7 @@
import BasicWidget from "../basic_widget.js";
import { Modal } from "bootstrap";
import utils from "../../services/utils.js";
import { t } from "../../services/i18n.js";
const TPL = /*html*/`
<div class="rosetta-warning-dialog modal mx-auto" tabindex="-1" role="dialog" style="z-index: 2000;">
@ -9,44 +10,38 @@ const TPL = /*html*/`
<div class="modal-header bg-danger text-white">
<h4 class="modal-title">
<i class="bx bx-error-circle"></i>
Performance Warning: Running Under Rosetta 2
<span class="rosetta-warning-title"></span>
</h4>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="alert alert-danger" role="alert">
<h5><strong>You are running the x64 version on Apple Silicon!</strong></h5>
<p>TriliumNext is currently running through Apple's Rosetta 2 translation layer, which causes significant performance degradation.</p>
<div class="alert alert-warning mb-3">
<strong> <span class="rosetta-warning-performance-impact"></span></strong><br>
<span class="rosetta-warning-message"></span>
</div>
<h6><strong>What does this mean?</strong></h6>
<ul>
<li>The application will be <strong>much slower</strong> than native performance</li>
<li>Operations may take 10-15 seconds that should take 1-2 seconds</li>
<li>Battery life will be reduced</li>
<li>The application may feel unresponsive</li>
</ul>
<p class="mb-3">
<strong>Recommendation:</strong> <span class="rosetta-warning-recommendation"></span>
</p>
<h6><strong>How to fix this:</strong></h6>
<ol>
<li>Download the <strong>ARM64</strong> version of TriliumNext from the releases page</li>
<li>Look for a filename ending in <code>-macos-arm64.dmg</code></li>
<li>Uninstall the current version and install the ARM64 version</li>
</ol>
<div class="alert alert-info" role="alert">
<strong>Note:</strong> Your data will be preserved during this process.
<div class="d-flex justify-content-between align-items-center">
<div>
<button class="download-correct-version-button btn btn-primary btn-lg me-2">
<i class="bx bx-download"></i>
<span class="rosetta-warning-download-link"></span>
</button>
<button class="continue-anyway-button btn btn-secondary" data-bs-dismiss="modal">
<span class="rosetta-warning-continue-anyway"></span>
</button>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="dontShowAgain">
<label class="form-check-label" for="dontShowAgain">
<span class="rosetta-warning-dont-show-again"></span>
</label>
</div>
</div>
</div>
<div class="modal-footer">
<button class="download-correct-version-button btn btn-primary btn-lg">
<i class="bx bx-download"></i>
Download ARM64 Version
</button>
<button class="continue-anyway-button btn btn-secondary" data-bs-dismiss="modal">
Continue Anyway
</button>
</div>
</div>
</div>
</div>`;
@ -62,6 +57,15 @@ export default class RosettaWarningDialog extends BasicWidget {
this.$downloadButton = this.$widget.find(".download-correct-version-button");
this.$continueButton = this.$widget.find(".continue-anyway-button");
// Populate text using translation keys
this.$widget.find(".rosetta-warning-title").text(t("rosetta_warning.title"));
this.$widget.find(".rosetta-warning-performance-impact").text(t("rosetta_warning.performance_impact"));
this.$widget.find(".rosetta-warning-message").text(t("rosetta_warning.message"));
this.$widget.find(".rosetta-warning-recommendation").text(t("rosetta_warning.recommendation"));
this.$widget.find(".rosetta-warning-download-link").text(t("rosetta_warning.download_link"));
this.$widget.find(".rosetta-warning-continue-anyway").text(t("rosetta_warning.continue_anyway"));
this.$widget.find(".rosetta-warning-dont-show-again").text(t("rosetta_warning.dont_show_again"));
this.$downloadButton.on("click", () => {
// Open the releases page where users can download the correct version
if (utils.isElectron()) {