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.

Any plans to support i18n? I could help…

I’ve been thinking on something like that:

var superloginConfig = {
  ...
  i18n: {
    en: {
      validation_failed: 'Form validation error',
      email_already_in_use: 'This email has already been taken'
      ...
    },

    'pt-BR': {
      validation_failed: 'Erro na validação do formulário',
      email_already_in_use: 'Este email já está sendo utilizado'
      ...
    }
  }  
  ...
};

Then, somehow, a valid lang will be passed as a parameter in the URL. Maybe when using the superlogin client…

Any thoughts? Thanks!

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
micky2becommented, Aug 30, 2016

You could already have something based on the browser/os language using accept-language

const acceptLanguage = require('accept-language');
acceptLanguage.languages(['en', 'pt-BR']); // list of language you can manage
const clientLanguage = req.headers['accept-language']; // Header added by browsers
console.log(acceptLanguage.get(clientLanguage)); // will display the most suitable language

I already used it on a project and it’s working pretty well. Additionally the client could send a preferred language through config.

0reactions
colinskowcommented, Aug 30, 2016

I would prefer something very simple like:

res.status(200).json({
  ok: true, 
  code: 'logged_out',
  message: 'Logged out'
});

The message would be in whichever language was requested in the header, with English as a fallback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is i18n? | Introduction to Internationalization - Lingoport
i18n is the process of preparing software so that it can support local languages, cultural settings, & meet the requirements of local markets....
Read more >
i18next documentation: Introduction
i18next goes beyond just providing the standard i18n features such as (plurals, context, interpolation, format). ... ​Learn more about supported frameworks​.
Read more >
i18n - MDN Web Docs - Mozilla
i18n. Functions to internationalize your extension. You can use these APIs to get localized strings from locale files packaged with your ...
Read more >
Angular Internationalization
Internationalization, sometimes referenced as i18n, is the process of designing and preparing your project for use in different locales around the world.
Read more >
What Is I18n? A Simple Definition of Internationalization | Phrase
Designing and developing in a way that removes barriers to localization or international deployment. · Providing support for features that may ...
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