mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-12-16 19:21:29 +00:00
Reemplazar $tf por $msg
This commit is contained in:
@@ -2,24 +2,24 @@ import { LOG_LEVEL_INFO, LOG_LEVEL_NOTICE, LOG_LEVEL_VERBOSE } from "octagonal-w
|
||||
import { AbstractModule } from "../AbstractModule.ts";
|
||||
import { sizeToHumanReadable } from "octagonal-wheels/number";
|
||||
import type { ICoreModule } from "../ModuleTypes.ts";
|
||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
||||
import { $msg } from "src/lib/src/common/i18n.ts";
|
||||
|
||||
export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule {
|
||||
async $allScanStat(): Promise<boolean> {
|
||||
this._log($tf("moduleCheckRemoteSize.logCheckingStorageSizes"), LOG_LEVEL_VERBOSE);
|
||||
this._log($msg("moduleCheckRemoteSize.logCheckingStorageSizes"), LOG_LEVEL_VERBOSE);
|
||||
if (this.settings.notifyThresholdOfRemoteStorageSize < 0) {
|
||||
const message = $tf("moduleCheckRemoteSize.msgSetDBCapacity");
|
||||
const ANSWER_0 = $tf("moduleCheckRemoteSize.optionNoWarn");
|
||||
const ANSWER_800 = $tf("moduleCheckRemoteSize.option800MB");
|
||||
const ANSWER_2000 = $tf("moduleCheckRemoteSize.option2GB");
|
||||
const ASK_ME_NEXT_TIME = $tf("moduleCheckRemoteSize.optionAskMeLater");
|
||||
const message = $msg("moduleCheckRemoteSize.msgSetDBCapacity");
|
||||
const ANSWER_0 = $msg("moduleCheckRemoteSize.optionNoWarn");
|
||||
const ANSWER_800 = $msg("moduleCheckRemoteSize.option800MB");
|
||||
const ANSWER_2000 = $msg("moduleCheckRemoteSize.option2GB");
|
||||
const ASK_ME_NEXT_TIME = $msg("moduleCheckRemoteSize.optionAskMeLater");
|
||||
|
||||
const ret = await this.core.confirm.askSelectStringDialogue(
|
||||
message,
|
||||
[ANSWER_0, ANSWER_800, ANSWER_2000, ASK_ME_NEXT_TIME],
|
||||
{
|
||||
defaultAction: ASK_ME_NEXT_TIME,
|
||||
title: $tf("moduleCheckRemoteSize.titleDatabaseSizeNotify"),
|
||||
title: $msg("moduleCheckRemoteSize.titleDatabaseSizeNotify"),
|
||||
timeout: 40,
|
||||
}
|
||||
);
|
||||
@@ -41,28 +41,28 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
|
||||
if (estimatedSize) {
|
||||
const maxSize = this.settings.notifyThresholdOfRemoteStorageSize * 1024 * 1024;
|
||||
if (estimatedSize > maxSize) {
|
||||
const message = $tf("moduleCheckRemoteSize.msgDatabaseGrowing", {
|
||||
const message = $msg("moduleCheckRemoteSize.msgDatabaseGrowing", {
|
||||
estimatedSize: sizeToHumanReadable(estimatedSize),
|
||||
maxSize: sizeToHumanReadable(maxSize),
|
||||
});
|
||||
const newMax = ~~(estimatedSize / 1024 / 1024) + 100;
|
||||
const ANSWER_ENLARGE_LIMIT = $tf("moduleCheckRemoteSize.optionIncreaseLimit", {
|
||||
const ANSWER_ENLARGE_LIMIT = $msg("moduleCheckRemoteSize.optionIncreaseLimit", {
|
||||
newMax: newMax.toString(),
|
||||
});
|
||||
const ANSWER_REBUILD = $tf("moduleCheckRemoteSize.optionRebuildAll");
|
||||
const ANSWER_IGNORE = $tf("moduleCheckRemoteSize.optionDismiss");
|
||||
const ANSWER_REBUILD = $msg("moduleCheckRemoteSize.optionRebuildAll");
|
||||
const ANSWER_IGNORE = $msg("moduleCheckRemoteSize.optionDismiss");
|
||||
const ret = await this.core.confirm.askSelectStringDialogue(
|
||||
message,
|
||||
[ANSWER_ENLARGE_LIMIT, ANSWER_REBUILD, ANSWER_IGNORE],
|
||||
{
|
||||
defaultAction: ANSWER_IGNORE,
|
||||
title: $tf("moduleCheckRemoteSize.titleDatabaseSizeLimitExceeded"),
|
||||
title: $msg("moduleCheckRemoteSize.titleDatabaseSizeLimitExceeded"),
|
||||
timeout: 60,
|
||||
}
|
||||
);
|
||||
if (ret == ANSWER_REBUILD) {
|
||||
const ret = await this.core.confirm.askYesNoDialog(
|
||||
$tf("moduleCheckRemoteSize.msgConfirmRebuild"),
|
||||
$msg("moduleCheckRemoteSize.msgConfirmRebuild"),
|
||||
{ defaultOption: "No" }
|
||||
);
|
||||
if (ret == "yes") {
|
||||
@@ -73,7 +73,7 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
|
||||
} else if (ret == ANSWER_ENLARGE_LIMIT) {
|
||||
this.settings.notifyThresholdOfRemoteStorageSize = ~~(estimatedSize / 1024 / 1024) + 100;
|
||||
this._log(
|
||||
$tf("moduleCheckRemoteSize.logThresholdEnlarged", {
|
||||
$msg("moduleCheckRemoteSize.logThresholdEnlarged", {
|
||||
size: this.settings.notifyThresholdOfRemoteStorageSize.toString(),
|
||||
}),
|
||||
LOG_LEVEL_NOTICE
|
||||
@@ -84,7 +84,7 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
|
||||
}
|
||||
|
||||
this._log(
|
||||
$tf("moduleCheckRemoteSize.logExceededWarning", {
|
||||
$msg("moduleCheckRemoteSize.logExceededWarning", {
|
||||
measuredSize: sizeToHumanReadable(estimatedSize),
|
||||
notifySize: sizeToHumanReadable(
|
||||
this.settings.notifyThresholdOfRemoteStorageSize * 1024 * 1024
|
||||
@@ -93,7 +93,7 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
|
||||
LOG_LEVEL_INFO
|
||||
);
|
||||
} else {
|
||||
this._log($tf("moduleCheckRemoteSize.logCurrentStorageSize", {
|
||||
this._log($msg("moduleCheckRemoteSize.logCurrentStorageSize", {
|
||||
measuredSize: sizeToHumanReadable(estimatedSize),
|
||||
}), LOG_LEVEL_INFO);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user