Some ideas about phrases

8 views
Skip to first unread message

Alexander Obuhovich

unread,
May 5, 2011, 11:11:09 AM5/5/11
to In-Portal Development
I've recently been in US and I've noticed one (among many) interesting solution: write manual ahead, so people don't need to think too much to make incorrect assumptions.

For example, related to phrases, we have lot of very useful fields in almost every form (database table) in In-Portal, but no one, except developers knows what most of them do.

Then maybe we need to implement site-wide inline help system. We already have ability to add descriptive hint about field/configuration variable usage, but we rarely actually use that ability.

Since any translatable text on a website is a phrase, then adding a lot of helping text will double (in worst case) language pack size.

To solve that problem before we get to it I'm proposing to add HintTranslation column into Phrase table, right after Translation column that we have already. This way every phrase we created can have hint translation stored under the same name as phrase is stored currently.

To determine what translation (regular or hint) should be used I'm proposing to add "hint:" in front of phrase name to get it's hint translation instead of actual translation. For example:
  • <inp2:m_Phrase name="la_fld_Name"/> - returns just la_fld_Name phrase translation;
  • <inp2:m_Phrase name="hint:la_fld_Name"/> - returns a hint translation, associated with la_fld_Name phrase.
In case, when la_fld_Name phrase's translation should have different hints on different forms, then we'll use same old approach, when phrase la_hint_AnotherHintForName is created and specified directly to inp_edit_box block via hint_label parameter in template. When not specified, then we'll assume, that hint phrase is "hint:" + phrase for field name (e.g. la_fld_Name in this case).


Another thing, that could be automated this way is actual "la_fld_Name" phrase. In 99% cases, when field name is Name, then corresponding phrase to show is "la_fld_Name". This way regular form field code in template would became <inp2:m_RenderElement name="inp_edit_box" field="Name"/> instead of <inp2:m_RenderElement name="inp_edit_box" field="Name" title="la_fld_Name" hint_label="la_hint_Name"/>.

Of course if we need to do a manual override, then ability to specify "title" parameter will stay.


Same way we can get rid of specifying "la_col_Name" in every grid column definition, however in 99% cases it matches "la_col_" + FieldName formula.



Some programming is needed to figure a way how to load both translation and hint translation phrases at once.






--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com

Dmitry A.

unread,
May 10, 2011, 4:33:26 PM5/10/11
to in-por...@googlegroups.com
Hi Alex,


I do like and fully support both ideas. Minimizing unnecessary work is very critical when it comes to time saving and optimizing.

I think we can surely create a task for this feature request or call it optimization.


DA

Phil -- wbtc.fr --

unread,
May 11, 2011, 5:24:09 AM5/11/11
to in-por...@googlegroups.com
yup, I like this idea also :)

2011/5/10 Dmitry A. <dand...@gmail.com>

Dmitry A.

unread,
May 11, 2011, 1:24:05 PM5/11/11
to in-por...@googlegroups.com
I guess we are ready for a task here.

Alex?

DA

Alexander Obuhovich

unread,
Aug 8, 2011, 1:12:05 PM8/8/11
to in-por...@googlegroups.com

Alexander Obuhovich

unread,
Aug 9, 2011, 1:54:20 PM8/9/11
to in-por...@googlegroups.com
Ready for testing.
phrase_storage_automation_core.patch
phrase_storage_automation_incommerce_only.patch
phrase_storage_automation_modules.patch

Dmitry A.

unread,
Aug 15, 2011, 12:13:03 AM8/15/11
to in-por...@googlegroups.com
Excellent work Alex!

I'll be testing this shortly in the next few days.


Cheers!

DA

Alexander Obuhovich

unread,
Aug 15, 2011, 3:12:05 AM8/15/11
to in-por...@googlegroups.com
I've mentioned this in task only, but I'll post here too:

I've create 2 additional translations for each phrase (empty by default):
  • hint phrase to be displayed as field hint, when present
  • column header phrase to be displayed in case this column is visible in grid 
This way ~300 phrases used for column header translations were absorbed into "column header phrase" translation of "la_fld_*" phrases.

  • To access hint translation use <inp2:m_Phrase name="hint:la_fld_FieldName"/>
  • To access column header translation use <inp2:m_Phrase name="column:la_fld_FieldName"/>
I've also made "title" parameter in grid column declaration optional. It will have "column:la_fld_<FieldName>" value by default, where <FieldName> is name of field to show in that column.

Phil -- wbtc.fr --

unread,
Aug 15, 2011, 4:56:44 AM8/15/11
to in-por...@googlegroups.com
really good job !

2011/8/15 Alexander Obuhovich <aik....@gmail.com>
Reply all
Reply to author
Forward
0 new messages