Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

aria-label should be an expression #1639

Closed
kschwidder opened this issue Feb 24, 2015 · 8 comments
Closed

aria-label should be an expression #1639

kschwidder opened this issue Feb 24, 2015 · 8 comments
Assignees

Comments

@kschwidder
Copy link

aria-label is currently a string which does not play nicely with multi-lingual apps. It should be an expression or string. In common apps you will set the label as {{LABEL | translate}}

@marcysutton
Copy link
Contributor

Hi, which component(s) are you talking about? Not everything uses aria-label.

@kschwidder
Copy link
Author

md-button primarily

@marcysutton
Copy link
Contributor

@kschwidder I was able to use angular-translate successfully for the aria-label on md-button with no problems–the text swapped out when I changed the preferred language. Can you provide more details on your situation? Are you actually finding errors or restrictions?

@kschwidder
Copy link
Author

Can you share the code example ? I have tried it with aria-label="{{'MYLABEL' | translate}}".

@marcysutton
Copy link
Contributor

I followed the docs on http://angular-translate.github.io/docs/#/guide and made local changes to our button demos to prove it worked (without committing). It looked something like this:

var app = angular.module('myApp', ['ngMaterial', 'pascalprecht.translate']);
app.config(['$translateProvider', function ($translateProvider) {
  $translateProvider.translations('en', {
    'CAKE': 'Eat cake'
  });
  $translateProvider.translations('de', {
    'CAKE': 'Cake eten'
  });
  $translateProvider.preferredLanguage('en');
}]);
<md-button aria-label="{{'CAKE' | translate}}"><span class="icon"></span></md-button>

@kschwidder
Copy link
Author

Will check again. Thx ! Will close the issues

@mxab
Copy link

mxab commented Mar 23, 2015

Hi, would it be better to have a aria-label-translate="CAKE" directive because as far as I understand it the translate filter is stateful and therefore should be not used to often?

@johnrix
Copy link

johnrix commented May 6, 2016

Here's a directive for that which I stumbled on.

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

No branches or pull requests

4 participants