question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

langDir does not support absolute path

See original GitHub issue

Version

nuxt-i18n: 6.13.1 nuxt: 2.13.3

Nuxt configuration

mode:

  • universal
  • [] spa

Nuxt-i18n configuration

const { resolve } = require('path');
...
        ['nuxt-i18n', {
            lazy: true
            langDir: resolve(__dirname, 'lang'),
        }]

–>

Steps to reproduce

I am trying to use lazy load on windows, but setting langDir to some diroctory with full path it will generate options.js:

...
export const langDir = 'C:\web\work\zeoshop\client\lang'
...

What is Expected?

backslash should be prefixed:

...
export const langDir = 'C:\\web\\work\\zeoshop\\client\\lang'
...

What is actually happening?

ERROR  in ./.nuxt/nuxt-i18n/options.js

Syntax Error: Unterminated string constant (9:23)

   7 | export const strategy = 'prefix_except_default'
   8 | export const lazy = true
>  9 | export const langDir = 'C:\web\work\zeoshop\client\lang\'

edit

or probably i do something bad, because it is forcing '~/<%= options.langDir %>'… what is ~ directory? why is it forced?

edit 2

we have translable translation in admin area, so probably locale’s file should be http://... ? to load newest translations every time by http/https protocol? but this is change request not bug (like this issue)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
padinkocommented, Jul 14, 2020

we have translations editable in admin area… so that JSONs are changeable in runtime, so we need to load actual json on every load (have some small cache time on server) so I need to get around building translations messages with webpack

1reaction
rchlcommented, Aug 4, 2020

we have translable translation in admin area, so probably locale’s file should be http://... ? to load newest translations every time by http/https protocol? but this is change request not bug (like this issue)

No, it can’t and won’t support http://.... Instead, you can assign a javascript file to the file property, that exports a function and you can have any custom logic you want there, including loading translations from a remote endpoint. See https://i18n.nuxtjs.org/lazy-load-translations.html for an example.

I’m treating this bug as being about supporting absolute paths in langDir and nothing more.

Read more comments on GitHub >

github_iconTop Results From Across the Web

langDir does not support absolute path · Issue #792 - GitHub
I am trying to use lazy load on windows, but setting langDir to some diroctory with full path it will generate options.js :...
Read more >
Relative path import fails, module not found, but absolute path ...
Upon migrating, however, I was met with an issue of Node.js not finding my command handler file using relative paths.
Read more >
Untitled
No leading slash, no trailing slash, full path, not relative to ABSPATH * * @since ... backward compatibility - won't work in some...
Read more >
getPath() - WinCC OA
This function determines the absolute paths for panels, scripts etc. ... filename, The file name whose absolute path is to be determined (an...
Read more >
build.gradle · devel · labs / Tablexia · GitLab
absolutePath }/assets/keystore/tablexiaTrustKeystore"). ... //Fallback value if sentry DSN is not defined (gradle parameter SENTRY_DSN_DEBUG or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found