prepare to move strings to the /scripts folder

This commit is contained in:
buzz-lightsnack-2007 2024-04-15 13:50:56 +08:00
parent 9dfdb3f44b
commit c03d7521f3
2 changed files with 55 additions and 2 deletions

View file

@ -2,7 +2,7 @@
// Import the file module.
// import file from `./net.js`;
const texts = (await import(chrome.runtime.getURL("scripts/read.js"))).default;
const texts = (await import(chrome.runtime.getURL("scripts/strings/read.js"))).default;
// Don't forget to set the class as export default.
export default class gemini {
@ -17,7 +17,7 @@ export default class gemini {
*/
constructor (key, model, version = {"API": "v1beta"}) {
if ((key) ? (((typeof key).includes(`str`)) ? !(key.trim()) : true) : true) {
throw new ReferenceError(texts.localized(`error_msg_APImissing`));
throw new ReferenceError((new texts(`error_msg_APImissing`)).localized);
};
// Register the API key privately.