fix: subtitle
This commit is contained in:
@@ -151,7 +151,7 @@ class ChromeTranslator {
|
||||
error.message &&
|
||||
error.message.includes("Other generic failures occurred")
|
||||
) {
|
||||
logger.error("Generic failure detected, resetting translator cache.");
|
||||
logger.info("Generic failure detected, resetting translator cache.");
|
||||
this.#translatorMap.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -355,7 +355,8 @@ export const withTimeout = (task, timeout, timeoutMsg = "Task timed out") => {
|
||||
* @param {*} maxLength
|
||||
* @returns
|
||||
*/
|
||||
export const truncateWords = (str, maxLength) => {
|
||||
export const truncateWords = (str, maxLength = 200) => {
|
||||
if (typeof str !== "string") return "";
|
||||
if (str.length <= maxLength) return str;
|
||||
const truncated = str.slice(0, maxLength);
|
||||
return truncated.slice(0, truncated.lastIndexOf(" ")) + " …";
|
||||
|
||||
Reference in New Issue
Block a user