<commit_before>define(
  'ephox.echo.api.AriaGrid',

  [
    'ephox.echo.api.Styles',
    'ephox.sugar.api.Attr',
    'ephox.sugar.api.Class',
    'ephox.sugar.api.Element',
    'ephox.sugar.api.Insert'
  ],

  function (Styles, Attr, Class, Element, Insert) {
    var base = function (element, label) {
      Attr.setAll(element, {
        'aria-label': label,
        'role': 'grid'
      });
    };

    var row = function (element) {
      Attr.set(element, 'role', 'row');
    };

    var cell = function (element, labelledby) {
      Attr.setAll(element, {
        'role': 'gridcell',
        'aria-labelledby': labelledby
      });
    };

    var createHelp = function (grid, rows, cols) {
      var r = [];
      for (var rowNum = 0; rowNum < rows; rowNum++) {
        // Temporary non-random number until we get it right
        var rowId = rowNum + 'h';//Id.generate('ephox-aria');
        var rowHelp = Element.fromTag('span');
        Attr.set(rowHelp, 'id', rowId);
        Class.add(rowHelp, Styles.resolve('aria-help'));
        Insert.append(rowHelp, Element.fromText((rowNum + 1) + ' high'));
        Insert.append(grid, rowHelp);

        r[rowNum] = [];

        for (var colNum = 0; colNum < cols; colNum++) {
          // Temporary non-random number until we get it right
          var colId = colNum + 'w';//Id.generate('ephox-aria');
          var cellHelp = Element.fromTag('span');
          Attr.set(cellHelp, 'id', colId);
          Class.add(cellHelp, Styles.resolve('aria-help'));
          Insert.append(cellHelp, Element.fromText((colNum + 1) + ' wide'));
          Insert.append(grid, cellHelp);

          r[rowNum][colNum] = colId + ' ' + rowId;
        }
      }
      return r;
    };

    return {
      base: base,
      row: row,
      cell: cell,
      createHelp: createHelp
    };
  }
);<commit_msg>TBIO-2336: Grid help is now using translations<commit_after>define(
  'ephox.echo.api.AriaGrid',

  [
    'ephox.echo.api.Styles',
    'ephox.epithet.Id',
    'ephox.scullion.Struct',
    'ephox.sugar.api.Attr',
    'ephox.sugar.api.Class',
    'ephox.sugar.api.Element',
    'ephox.sugar.api.Insert'
  ],

  function (Styles, Id, Struct, Attr, Class, Element, Insert) {
    var help = Struct.immutable('help', 'ids');

    var base = function (element, label) {
      Attr.setAll(element, {
        'aria-label': label,
        'role': 'grid'
      });
    };

    var row = function (element) {
      Attr.set(element, 'role', 'row');
    };

    var cell = function (element, labelledby) {
      Attr.setAll(element, {
        'role': 'gridcell',
        'aria-labelledby': labelledby
      });
    };

    var createHelp = function (rows, cols, translations) {
      var gridHelp = Element.fromTag('div');
      Class.add(gridHelp, Styles.resolve('aria-help'));

      // TODO: snooker util.repeat instead of mutation
      var ids = [];
      for (var rowNum = 0; rowNum < rows; rowNum++) {
        // Temporary non-random number until we get it right
        var rowId = Id.generate('ephox-aria');
        var rowHelp = Element.fromTag('span');
        Attr.set(rowHelp, 'id', rowId);
        Class.add(rowHelp, Styles.resolve('aria-help'));
        Insert.append(rowHelp, Element.fromText(translations('table.picker.rows', (rowNum + 1))));
        Insert.append(gridHelp, rowHelp);

        // TODO: snooker util.repeat instead of mutation
        ids[rowNum] = [];
        for (var colNum = 0; colNum < cols; colNum++) {
          // Temporary non-random number until we get it right
          var colId = Id.generate('ephox-aria');
          var cellHelp = Element.fromTag('span');
          Attr.set(cellHelp, 'id', colId);
          Class.add(cellHelp, Styles.resolve('aria-help'));
          Insert.append(cellHelp, Element.fromText(translations('table.picker.cols', (colNum + 1))));
          Insert.append(gridHelp, cellHelp);

          ids[rowNum][colNum] = colId + ' ' + rowId;
        }
      }
      return help(gridHelp, ids);
    };

    return {
      base: base,
      row: row,
      cell: cell,
      createHelp: createHelp
    };
  }
);
{'fraction_non_alphanumeric': 0.15765107212475635, 'fraction_numerical': 0.0029239766081871343, 'mean_word_length': 2.2787539936102235, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4539842', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1348, 'n_words': 288}