samk-dev / nuxt-translation-manager

Simple and easy to use translation manager for Nuxt and Nuxt-i18n that allows translation management from a single CSV file.
MIT License
15 stars 3 forks source link

feat: Allow external (absolute) file paths #22

Open phillipmohr opened 4 months ago

phillipmohr commented 4 months ago

It would be great if the langDir would also allow absolute paths.

I'd like to host my CSV on Supabase so people in my team can easily edit it without the need to build a UI in my application.

samk-dev commented 4 months ago

Hey thank you Philip. Do you mean to host the csv file on Supabase storage? Please could you past here an example of how would the url look like?

For the time being the teams I collaborate with the edit the csv in google docs or any CSV editor they have and they send me the file and I just drop it in the langDir

phillipmohr commented 4 months ago

Yes, it would be nice if the CSV can be hosted basically anywhere.

The URL in Supabase can look like this: https://mysupabaseproject.supabase.co/storage/v1/object/public/myfolder/anotherfolder/translations.csv

In the meantime I have just build the UI for the CSV upload but I believe it could become handy if the CSV could also be hosted somewhere else

phillipmohr commented 1 week ago

Hi, I just wanted to add something: I'm hosting on Vercel and it seems like Vercel doesn't allow writing files, meaning this doesn't work

const filePath = path.join(process.cwd(), 'public', 'locales', 'translations.csv');
fs.writeFileSync(filePath, csvFile.data);

It is recommended to use an external provider but unfortunately I can't specify an absolute external URL.

So for me, this is unfortunately not a "nice to have" but a must have because otherwise I can't use the nuxt translation manager on my prod environment (Vercel)