I'm trying to load i18next translation files from a directory in OneDrive. When I try to do so, playwright keeps looking for the files in the C:\ drive. Is it imposible to load files from OneDrive? Can anyone tell me what I am doing wrong?
See my code below:
const localePath = path.resolve('./locales');
// resolves correctly to C:\Users\myuserpath\OneDrive - MyStuff\QA-Automation\locales
i18next
.use(FsBackend)
.init({
lng: 'en',
ns:['signin.page', 'chat.page','session.page', 'landing.page', 'userprofile.page'],
FsBackend:{
FsBackendOptions: {loadPath: path.join(localePath, '/{{lng}}/{{ns}}.page.json'),},
}
})
//Expected result:
//Translations should load from C:\Users\myuserpath\OneDrive - MyStuff\QA-Automation\locales\en\NAMESPACEFILE.page.json
//Actual result:
//[Error: ENOENT: no such file or directory, open 'C:\locales\en\NAMESPACEFILE.page.json'
Other things I have tried:
Using onedrive:
const myOneDrive = process.env.OneDriveCommercial;
const longerpath = path.join(myOneDrive, '/QA-Automation/locales/{{lng}}/{{ns}}.page.json');
i18next
.use(FsBackend)
.init({
//blah blah
FsBackend:{ FsBackendOptions: {loadPath: longerpath},},
})
Hardcoding the full path:
const fullpath = 'C:\Users\myuserpath\OneDrive - MyStuff\QA-Automation\locales'
FsBackend:{ FsBackendOptions: {loadPath: fullpath},},
Hardcoding the full path in init:
FsBackendOptions: {loadPath: 'C:/Users/myuserpath/OneDrive - MyStuff/QA-Automation/locales/{{lng}}/{{ns}}.page.json,},
Swearing:
const dev_reaction = '$#!(#&*$@$!!!'
The result is always the same. It ignores the Onedrive completely, and tries to load from c:\locales\etc.