Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Localization of Node's own output/error messages #12

Closed
jasnell opened this issue Aug 11, 2015 · 7 comments
Closed

Localization of Node's own output/error messages #12

jasnell opened this issue Aug 11, 2015 · 7 comments
Assignees

Comments

@jasnell
Copy link
Member

jasnell commented Aug 11, 2015

Node's error messages, help and debug output are currently not localized. I have been investigating what it would take to enable localization of Node's output. I will use this issue to track the progress of that investigation.

@jasnell jasnell self-assigned this Aug 11, 2015
@kevinmartin
Copy link

Linking your issue: nodejs/node-v0.x-archive#9174

My 2 cents:

  • There should be an automated build process that extracts the strings and places them in centralized file(s) - Either a single language file (or multiple files, similar to Gettext domains).
    • format should be a universally acceptable format that can be imported into a tool like Transifex.
  • If we use the suggested L10N("KEY", "Fallback string") format:
    • the build process needs to check that if the function is called in multiple places, the fallback string should be the same everywhere.
    • KEY should be in a pre-defined, specific format for consistency.
  • We need to also localize stack messages.
  • It would be nice if we can have a centralized place (ie. https://nodejs.org/errors/KEY?stack=...) of viewing all of these errors online with explanations and the typical way(s) to solve it.
    • Where the stack parameter is a language-agnostic representation of the error stack message.
    • And the entire Error message/stack can be translated to various languages on the website.
      • This is good, because if someone is running a version of node that is not localized to them, they can still see the message online in their own language.
    • This is somewhat beyond the scope of this WG, though.
    • Angular does a good job with this (minus the translation aspect), ie:
Error: [$injector:modulerr] http://errors.angularjs.org/1.3.15/$injector/modulerr?p0=myApp&p1=%5B%24injector%3Anomod%5D%20

@jasnell
Copy link
Member Author

jasnell commented Aug 11, 2015

There are some additional challenges.

  1. Currently, error handling and reporting within Node is extremely inconsistent.
  2. V8's own error messages are not localized. However, Chrome doesn't seem to have a problem with this and shows localized messages so we need to investigate more about what they are doing.
  3. We need to ensure that localized error messages are still easily searchable. There are two approaches I am considering: a) including a simple, non-changing identifier with each message and b) outputting both the default (english) and localized versions of each message. I am also investigating the possibility of an npm installable tool that can provide extended explanations of specific messages (e.g. something like node-explain ERR0001 and have it output a localized description of the problem. This ties in well with the centralized place for viewing error details online.

@kevinmartin
Copy link

As far as your point 3a, I thought KEY was the simple, non-change identifier?

@jasnell
Copy link
Member Author

jasnell commented Aug 12, 2015

Yep. We'll just need to make sure a consistent convention is used for naming the KEY

@kevinmartin
Copy link

As far as your point 2, I'm not much of a C++ guy, but I did find this. Seems like V8 uses MessageHandler::GetLocalizedMessage. Would this be correct?

@srl295
Copy link
Member

srl295 commented Oct 24, 2015

initial work (backlink) nodejs/node#3413

@srl295
Copy link
Member

srl295 commented Mar 27, 2017

looks like this was landed in nodejs/node#11220
with tracking at nodejs/node#11273

thanks @jasnell !

@srl295 srl295 closed this as completed Mar 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants