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

I18n support? #311

Open
ctjhoa opened this issue Jan 11, 2017 · 5 comments
Open

I18n support? #311

ctjhoa opened this issue Jan 11, 2017 · 5 comments

Comments

@ctjhoa
Copy link

ctjhoa commented Jan 11, 2017

Hi,
It seems that there is no ember-i18n support.
For example, with columns:

import { translationMacro as t } from 'ember-i18n';
// ...
columns: computed(function() {
    return [{
      label: t('agreement.title'),
      valuePath: 'metadata.title'
    }];
  }),

Assertion Failed: Cannot translate agreement.title. <(unknown mixin):ember591> does not have an i18n.
Is this something on the roadmap or is there another way?

@ctjhoa
Copy link
Author

ctjhoa commented Jan 11, 2017

I found a workaround but it's kinda ugly

titleHeader: t('agreement.title'),
columns: computed('titleHeader', function() {
    return [{
      label: get(this, 'titleHeader'),
      valuePath: 'metadata.title'
    }];
  }),

@offirgolan
Copy link
Collaborator

There is currently no out-of-the-box solution for this but it should be fairly easy to do by creating your own column type and overriding the label property.

In your column definition, you can pass a labelKey: 'agreement.title' instead of label: 'Foo Bar' and then use that via column.labelKey in your column type.

@alexander-alvarez
Copy link
Collaborator

any plans to have 'official' column types, cell-components, etc that are used a lot by the community?
Or even just a poll of what people have implemented to improve documentation to show the different use cases that ember-light-table can achieve?

@ynnoj
Copy link
Contributor

ynnoj commented Feb 23, 2017

Import the i18n service in the component and you can use the t helper in the columns declaration.

baseColumns: computed(function() {
  const i18n = this.get('i18n');

  return [{
    label: i18n.t('table.catalogue.name.key'),
    valuePath: 'name'
  }]
}

@offirgolan
Copy link
Collaborator

@alexander-alvarez Yeah I need to work on adding some more default cell & column types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants