-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
Thanks for this project, it's awesome to not have to have @machty 's source just copy/pasted into our project anymore.
We originally modified the gist just slightly to allow automatically providing a page title in our Ember I18n translation file so we didn't need to create a route file simply to provide a title
or titleToken
.
To get it working with this add-on we made use of an initializer to support the auto-lookup. Something like this:
import Ember from 'ember';
export function initialize(/* container, application */) {
Ember.Route.reopen({
titleToken: Ember.computed('routeName', function() {
var pageTitleKey = `pageTitles.${this.get(routeName)}`;
if(Ember.I18n.exists(pageTitleKey)) {
return Ember.I18n.t(pageTitleKey);
}
})
});
}
export default {
name: 'route',
initialize: initialize
};
and then we provide a translation for the route name in our translations file, like this:
en = {
pageTitles: {
application: 'My Page Name'
...
}
}
I'm happy to keep-on-keepin' on with our custom re-open but I was curious if this sort of thing would be helpful for anyone else using this project.
Metadata
Metadata
Assignees
Labels
No labels