Localization of messages

25 views
Skip to first unread message

James Snell

unread,
Oct 7, 2015, 10:32:04 AM10/7/15
to v8-dev
Hello there! I'm currently investigating the feasibility of introducing output localization both to Node and V8. Given that V8 currently hard codes it's messages in messages.h it's certainly a non-trivial task. I'd like to explore (a) if l10n of V8's error messages would be possible and (b) the most efficient way of doing so. 

- James

(originally had posted here: https://code.google.com/p/v8/issues/detail?id=4475)

Yang Guo

unread,
Oct 8, 2015, 8:18:12 AM10/8/15
to v8-dev

I could imagine an API that changes the message template backing store to an embedder-provided address. However, that would require keeping the localization up-to-date in lockstep with v8, as the array indices may change.

Yang


--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James M Snell

unread,
Oct 8, 2015, 11:13:15 AM10/8/15
to v8-...@googlegroups.com
Yeah, this is the direction I was thinking but you're right, with the
current set up it's fairly brittle. I'll see if I can come up with an
implementation proposal that makes sense without causing too much
churn.
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-dev" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/v8-dev/CzW7k_ot5fQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Yang Guo

unread,
Oct 8, 2015, 11:36:50 AM10/8/15
to v8-...@googlegroups.com

also I can imagine that translated templates could have a different ordering of the message arguments. would we need numbered placeholders? i.e. %1 %2 %3 instead simply %?

James M Snell

unread,
Oct 8, 2015, 11:46:31 AM10/8/15
to v8-...@googlegroups.com
Yes. There is a potential need for other such changes also. I won't
know the extent until I get in and start pulling the message templates
apart a bit. I'm hoping to keep the changes as minimal as possible.

Yang Guo

unread,
Oct 8, 2015, 12:08:25 PM10/8/15
to v8-...@googlegroups.com

Please submit an intent-to-implement once you have a plan how to implement this, so that the whole team can figure out whether we want this in upstream v8. Thanks.

Yang

James M Snell

unread,
Oct 8, 2015, 12:18:35 PM10/8/15
to v8-...@googlegroups.com
Will do!

Jakob Kummerow

unread,
Oct 8, 2015, 12:21:40 PM10/8/15
to v8-...@googlegroups.com
Can you shed some light on the motivation for this effort? What's the envisioned use case?

I think V8's messages aren't usually user-visible -- or are they? Is this just about translating "TypeError" and the like for the benefit of non-English-speaking developers?

James M Snell

unread,
Oct 8, 2015, 12:37:30 PM10/8/15
to v8-...@googlegroups.com
Of course. Yes, the key motivation is really coming from Node. We
(IBM) want to be able to produce localized outputs such as help, debug
and error messages in a reasonable way but there are a handful of
errors produced by V8 that are not intercepted by Node (For instance,
when someone attempts to modify a frozen object). We do not want to
end up with a situation where only some of the messages are localized
and others are not so I'm attempting to figure out a workable path.
And yes, the goal is to produce localized outputs for non-English
speaking developers (done in a way that is still "search friendly" so
that developers can easily look up details and documentation for any
specific error).

Within node core itself, assuming this capability lands, the default
would be for non-localized outputs. Vendors (such as IBM) who build on
top of Node would have the ability to generate
localized-but-still-fully-compatible binaries. We (like many
companies) have specific obligations to provide localized versions of
the software we provide and Node currently requires an exception
process for us since a localized version is not currently possible.
Reply all
Reply to author
Forward
0 new messages