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

incompeteFallbackMessage is not correct structure when building translations #1810

Closed
straker opened this issue Sep 12, 2019 · 2 comments
Closed
Assignees
Labels
core Issues in the core code (lib/core) fix Bug fixes hacktoberfest Help contribute during the month of October to participate https://hacktoberfest.digitalocean.com/

Comments

@straker
Copy link
Contributor

straker commented Sep 12, 2019

When we generate lang files using grunt translation --lang=<lang-code>, the incompleteFallbackMessage is generated as an object structure with undefined as a property name. However, the message in axe is always treated as just a string.

First, we need to fix the translation generator to output a string value instead of an object

incompleteFallbackMessage: result.misc.reduce(function(out, misc) {
  return misc.incompleteFallbackMessage ? misc.incompleteFallbackMessage : out
}, '')

Second, we need to update all the locale files to match the new format

// ja.json
"incompleteFallbackMessage": "次のすべてを修正します:{{~it:value}}\n  {{=value.split('\\n').join('\\n  ')}}{{~}}"

Third, we need to update the code that uses these translations to accept the new format

if (locale.incompleteFallbackMessage) {
  this.data.incompleteFallbackMessage = mergeFallbackMessage(
    this.data.incompleteFallbackMessage,
    locale.incompleteFallbackMessage
  );
}

Lastly, we need to update the associated test to show that it's all working

axe.configure({
  locale: {
    lang: 'lol',
    failureSummaries: {
      any: {
        failureMessage: 'foo'
      },
      none: {
        failureMessage: 'bar'
      }
    },
    incompleteFallbackMessage:  'baz'
  }
});
@straker straker added fix Bug fixes core Issues in the core code (lib/core) labels Sep 12, 2019
@straker straker added the hacktoberfest Help contribute during the month of October to participate https://hacktoberfest.digitalocean.com/ label Oct 11, 2019
@jeankaplansky
Copy link
Contributor

No customer-facing documentation required.

@padmavemulapati
Copy link

Verified , working as expected.
Seeing the japanese language failure summary, on running axe.ja.js (which is generating from grunt build --lang=ja)

"failureSummary": "次のすべてを修正します:\n  The lang attribute can only be Dylan"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues in the core code (lib/core) fix Bug fixes hacktoberfest Help contribute during the month of October to participate https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

No branches or pull requests

4 participants