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.

route translation

See original GitHub issue

This is not an issue.

But is it possible to have the route names in a json file?

For example: en.json

{
  "registration": "signup"
}

fr.json

{
  "registration": "registration"
}

and have something like:

app.get("/" + translatedRouteHere, function(...) {
  res.render('signup', {...});
})

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mashpiecommented, May 22, 2016

You could include your param “as is” in your locale key. I’ll gist an example when back to desktop…

Am 22.05.2016 um 11:26 schrieb Peter Vercauteren notifications@github.com:

Offcourse 😃

But what if I do wanted to include the param in my routes. I tried following:

/* GET termsandcondition page. */ router.get(‘/:locale/’ + i18n.l(‘menu.termsandcondition.url’), function(req, res, next) { req.setLocale(req, req.params.locale); res.render(‘pages/’ + req.getLocale() + ‘/termsandcondition’, {menu: ‘termsandcondition’, title: req.(‘menu.termsandcondition.title’)}); });

/* GET organisation page. */ router.get(‘/:locale/’ + i18n.l(‘menu.organisation.url’), function(req, res, next) { req.setLocale(req, req.params.locale); res.render(‘pages/’ + req.getLocale() + ‘/organisation’, {menu: ‘organisation’, title: req.(‘menu.organisation.title’)}); }); unfortunately it gives me a 404.

Or do you suggest to set my ‘menu.[item].url’ to ‘/[lang]/[item]’? Which offcourse is easier to assign to navigation items.

I tried this too, but the problem is I need to set ‘setLocale’. But how do I retrieve the language then if my route params don’t have any :locale?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

0reactions
goowiknscommented, May 22, 2016

Okay, to simplify the coding as I have to finish the first part this evening 😃

I removed the locale parameter and used a simple language switcher & cookie from: #237

Thanks again for your great support & amazing module 👍 Personally I don’t need any help on this issue for now. But maybe for later it might be helpful for others.

Read more comments on GitHub >

github_iconTop Results From Across the Web

route | translation English to Spanish: Cambridge Dictionary
route translations: ruta, ruta [feminine, singular], camino [masculine, singular], ruta [feminine, ... Learn more in the Cambridge English-Spanish Dictionary.
Read more >
route – translation into English from French
One (Online-Translator.com) is a free online translator and dictionary in 20+ languages. Enjoy accurate, natural-sounding translations powered by PROMT Neural ...
Read more >
Spanish Translation of “route” - Collins Dictionary
Spanish Translation of “route” | The official Collins English-Spanish Dictionary online. Over 100000 Spanish translations of English words and phrases.
Read more >
Translate "route" from English to Spanish - Interglot Mobile
English to Spanish translation results for 'route' designed for tablets and mobile devices. Possible languages include English, Dutch, German, French, ...
Read more >
Route Translation Guide
If today, you ride: In the new network, you'll likely use: Change Type 5‑Marigny‑Bywater 8‑St. Claude‑Arabi Route Removed 15‑Freret 57‑Franklin‑Freret Name Change; Destination Chang... 16‑Claiborne 51‑St.Bernard‑Claiborne...
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