Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(i18n): always use english for logs #5727

Merged
merged 5 commits into from
Jul 26, 2018
Merged

Conversation

patrickhulce
Copy link
Collaborator

fixes what @paulirish found in #5726

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love the extraction of resolveIcuMessageInstanceId

@@ -218,7 +218,7 @@ class Runner {
*/
static async _runAudit(auditDefn, artifacts, settings, runWarnings) {
const audit = auditDefn.implementation;
const status = `Evaluating: ${audit.meta.title}`;
const status = `Evaluating: ${i18n.getDisplayValue(audit.meta.title)}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since displayValue is a thing i dont think we should reuse that name for this.

getOriginalMessage ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I hesitated here, original message isn't quite right either. how bout

getFormatted
toFormatted
getFormattedValue
getFormattedString
toFormattedString

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getLocaleString? reminiscent of toLocaleString but different

(I have no strong opinions)

@@ -251,5 +274,7 @@ module.exports = {
getDefaultLocale,
getRendererFormattedStrings,
createMessageInstanceIdFn,
getDisplayValue,
resolveIcuMessageInstanceId,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to be exported and public? could keep it _private to the file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sure if you'd prefer :)

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* @return {string}
*/
function getDisplayValue(icuMessageIdOrRawString, locale) {
return MESSAGE_INSTANCE_ID_REGEX.test(icuMessageIdOrRawString) ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit: with these really long lines the ternary gets pretty lost. IMO more readable as

if (MESSAGE_INSTANCE_ID_REGEX.test(icuMessageIdOrRawString)) {
  return resolveIcuMessageInstanceId(icuMessageIdOrRawString, locale).formattedString;
}

return icuMessageIdOrRawString;

(at first I thought maybe the motivation was line length but this is in the clear :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me, done

* @param {LH.Locale} [locale]
* @return {string}
*/
function getDisplayValue(icuMessageIdOrRawString, locale) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch the test-utils helper to use this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, that was the goal :)

@paulirish paulirish merged commit 6af477a into master Jul 26, 2018
@paulirish paulirish deleted the fix_log_audit_titles branch July 26, 2018 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants