Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11898] CLI: Refactor i18n functions to return an object containing original English string

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsCLI
Labelscb-tooling
ReporterChris Barber
AssigneeChris Barber
Created2012-11-29T22:10:47.000+0000
Updated2016-08-26T04:28:21.000+0000

Description

Make it so __() and __n() return an object instead of a string with a toString() method that outputs the translated string. The object would also expose the original English string. Why is this needed? So that a logger can output one language to the terminal and the original string to the log file. For example, say someone has their locale set to es_ES and they run a build, then the build log would be in Spanish. Then they run into a problem and they need to create a ticket and attach the build log. The developer fixing the ticket will need to know Spanish in order to track down where exactly in the build the issue is occurring. By outputting the translated string to the screen and the original to the log file, we can understand the logs better. I experimented with ways of doing this. Returning an object is going to be tricky. The problem is we do a bunch of logger.info(__('howdy') + '\n') and that forces toString() all the time. Maybe there's a way to use multiple streams and/or integrate the i18n functions into the logger mechanism so that they are aware of each other?

Comments

No comments

JSON Source