Override Dictionary Term

150 views
Skip to first unread message

Ryan

unread,
Oct 13, 2011, 3:55:43 PM10/13/11
to simpleSAMLphp
Is there a way to override a dictionary term or entire dictionary? I'd
like to change the text of "login:user_pass_text" and a couple others
without modifying the original definition file. That way upgrading is
easier. Thanks!

~ Ryan

Olav Morken

unread,
Oct 14, 2011, 4:56:27 AM10/14/11
to simple...@googlegroups.com

Unfortunately not. I added it as a feature request to our issue
tracker, but cannot make any promises about whether or when it will be
implemented:

http://code.google.com/p/simplesamlphp/issues/detail?id=440


Regards,
Olav Morken
UNINETT / Feide

Peter Schober

unread,
Oct 14, 2011, 7:58:49 AM10/14/11
to simple...@googlegroups.com
* Olav Morken <olav....@uninett.no> [2011-10-14 10:56]:

> On Thu, Oct 13, 2011 at 12:55:43 -0700, Ryan wrote:
> > Is there a way to override a dictionary term or entire dictionary? I'd
> > like to change the text of "login:user_pass_text" and a couple others
> > without modifying the original definition file. That way upgrading is
> > easier. Thanks!
>
> Unfortunately not. I added it as a feature request to our issue
> tracker, but cannot make any promises about whether or when it will be
> implemented:

It's not? I'm pretty sure it is as I've done this in the past?

$ fgrep -l user_pass_text simplesamlphp/modules/MYMODULE/dictionaries/login.*
simplesamlphp/modules/MYMODULE/dictionaries/login.definition.json
simplesamlphp/modules/MYMODULE/dictionaries/login.translation.json

I'm probably not understanding either the question or the answer.
-peter

Olav Morken

unread,
Oct 14, 2011, 8:15:04 AM10/14/11
to simple...@googlegroups.com

I assume that this dictionary is used from "MYMODULE"? I believe the
question was about overriding dictionary entries for existing modules
(along the same lines as one would override existing templates by
implementing a custom theme).

Peter Schober

unread,
Oct 14, 2011, 8:29:17 AM10/14/11
to simple...@googlegroups.com
* Olav Morken <olav....@uninett.no> [2011-10-14 14:15]:

> > > > Is there a way to override a dictionary term or entire dictionary? I'd
> > > > like to change the text of "login:user_pass_text" and a couple others
> > > > without modifying the original definition file. That way upgrading is
> > > > easier. Thanks!
> > >
> > > Unfortunately not. I added it as a feature request to our issue
> > > tracker, but cannot make any promises about whether or when it will be
> > > implemented:
> >
> > It's not? I'm pretty sure it is as I've done this in the past?
> >
> > $ fgrep -l user_pass_text simplesamlphp/modules/MYMODULE/dictionaries/login.*
> > simplesamlphp/modules/MYMODULE/dictionaries/login.definition.json
> > simplesamlphp/modules/MYMODULE/dictionaries/login.translation.json
> >
> > I'm probably not understanding either the question or the answer.
>
> I assume that this dictionary is used from "MYMODULE"? I believe the
> question was about overriding dictionary entries for existing modules
> (along the same lines as one would override existing templates by
> implementing a custom theme).

I'm sorry I still don't get it. I override the text for
login:user_pass_text this way (at leat I think I do, it's been a while
I set this up), so I would have thought that the anwser for the OP is:
"Yes, you'll need to setup your own module and you can override other
dictionaries there"?
Maybe there's some other hackery necessary for this to work, that I
forgot about.
-peter

Ryan

unread,
Oct 14, 2011, 9:57:25 AM10/14/11
to simpleSAMLphp
Yep, I was referring about overriding dictionaries from existing
modules (just like themes), and in this case the login.definition.json
file in the main dictionaries directory. Sorry for the confusion. The
documentation leads me to think it may be possible but I couldn't
figure it out.

~ Ryan

On Oct 14, 7:15 am, Olav Morken <olav.mor...@uninett.no> wrote:
> On Fri, Oct 14, 2011 at 13:58:49 +0200, Peter Schober wrote:
> > * Olav Morken <olav.mor...@uninett.no> [2011-10-14 10:56]:

Peter Schober

unread,
Oct 14, 2011, 9:59:24 AM10/14/11
to simpleSAMLphp
* Ryan <pan...@traileyes.com> [2011-10-14 15:57]:

> Yep, I was referring about overriding dictionaries from existing
> modules (just like themes), and in this case the login.definition.json
> file in the main dictionaries directory. Sorry for the confusion.

That's what I'm doing,
-peter

Peter Schober

unread,
Oct 14, 2011, 10:06:59 AM10/14/11
to simple...@googlegroups.com
* Peter Schober <peter....@univie.ac.at> [2011-10-14 14:30]:

> "Yes, you'll need to setup your own module and you can override other
> dictionaries there"?
> Maybe there's some other hackery necessary for this to work, that I
> forgot about.

Ah, I remember now. You'd also need to override the template itself
(from your module) and point it to your dictionary definitions.

So you'd copy simplesamlphp/modules/core/templates/loginuserpass.php
to simplesamlphp/modules/MYMODULE/themes/MYTHEME/core/loginuserpass.php
and change things like $this->t('{login:user_pass_text}')
to $this->t('{MYMODULE:login:user_pass_text}').

It'll then pick up your copy of the dictionary (from the path I sent
before) with your changes. Does not modify any upstream code.
-peter

Ryan

unread,
Oct 14, 2011, 10:20:11 AM10/14/11
to simpleSAMLphp
If you were able to make it work I'd be great full if you could
explain. I'm setting up a new installation and want to make future
updates as easy as possible. I have setup my own module for a custom
theme and have tried throwing these dictionaries in there, but no
luck. Thanks!

~ Ryan

On Oct 14, 7:29 am, Peter Schober <peter.scho...@univie.ac.at> wrote:
> * Olav Morken <olav.mor...@uninett.no> [2011-10-14 14:15]:

Ryan

unread,
Oct 14, 2011, 12:45:12 PM10/14/11
to simpleSAMLphp
That makes sense, just modify the template to use custom dictionary
terms. Unfortunately this could still cause upgrade issues if the
original template has changed significantly. For now I'll just modify
the original dictionary file until the new feature is implemented.
Thanks everyone!

~ Ryan


On Oct 14, 9:06 am, Peter Schober <peter.scho...@univie.ac.at> wrote:
> * Peter Schober <peter.scho...@univie.ac.at> [2011-10-14 14:30]:

Peter Schober

unread,
Oct 15, 2011, 8:27:08 AM10/15/11
to simpleSAMLphp
* Ryan <pan...@traileyes.com> [2011-10-14 18:45]:

> That makes sense, just modify the template to use custom dictionary
> terms. Unfortunately this could still cause upgrade issues if the
> original template has changed significantly.

Well, I suppose so. You could chose to minimize the diff to upsteam by
regularly merging changes from upstream (e.g. once every new release,
as you'll want to keep up to date anyway), or only have those
definitions and translations your module that actually differ from the
upstream ones (making it small and easy to adapt). Whatever suits you.
-peter

Reply all
Reply to author
Forward
0 new messages