Automatic phrase type based on it's name
Imported from: http://groups.google.com/group/in-portal-dev/browse_thread/thread/c1e6865488461ef6#
I think, that we need a way for In-Portal to automatically guess phrase type based on:
user action (that leads to user to phrase adding/editing screen)
phrase name (that is entered by user)
By User Action
translation phrase while on Front-End (special translate link OR orange edit button) - "Front-End" type;
toolbar button "Add" click in phrase list in administrative console - "Admin" type.
By Phrase Name
phrase name starts with "lu_" - "Front-End" type;
phrase name starts with "la_" - "Admin" type.
Detection by phrase name overrides detection by user action, since it's bad style to mark phrases, that starts with "lu_" belonging to administrative console.
When both "Phrase Name" and "Phrase Type" fields are visible on phrase adding/editing form, then I also suggest to place "*onblur*" event on "Phrase Name" field to change "Phrase Type", when user starts to enter phrase translation.
In this case we could make "Phrase Type" field read-only to user. There is one small problem with that: phrases, that have "Both" type. We should eliminate that as soon as possible, but in this scheme their type will be changed automatically based on their name.
I like the idea - sounds like feature for 5.2.0 or future.
Here is the list of phrase with Both type:
==========
<PHRASE Label="la_importlang_phrasewarning" Module="Core"
Type="2"><![CDATA[Enabling this option will undo any changes you have made
to existing phrases]]></PHRASE>
<PHRASE Label="la_PhraseType_Both" Module="Core"
Type="2"><![CDATA[Both]]></PHRASE>
<PHRASE Label="la_prompt_DupRating" Module="Core" Type="2"><![CDATA[Allow
Duplicate Rating Votes]]></PHRASE>
<PHRASE Label="la_prompt_DupReviews" Module="Core" Type="2"><![CDATA[Allow
Duplicate Reviews]]></PHRASE>
<PHRASE Label="la_prompt_overwritephrases" Module="Core"
Type="2"><![CDATA[Overwrite Existing Phrases]]></PHRASE>
<PHRASE Label="la_Text_backup_access" Module="Core"
Type="2"><![CDATA[In-Portal does not have access to write to this
directory]]></PHRASE>
<PHRASE Label="la_Text_Invalid" Module="Core"
Type="2"><![CDATA[Invalid]]></PHRASE>
<PHRASE Label="la_Text_Not_Validated" Module="Core" Type="2"><![CDATA[Not
Validated]]></PHRASE>
<PHRASE Label="la_users_subscriber_group" Module="Core"
Type="2"><![CDATA[Assign mailing list subscribers to group]]></PHRASE>
<PHRASE Label="lu_field_cachedrating" Module="Core"
Type="2"><![CDATA[Rating]]></PHRASE>
<PHRASE Label="lu_field_cachedreviewsqty" Module="Core"
Type="2"><![CDATA[Number of Reviews]]></PHRASE>
<PHRASE Label="lu_field_cachedvotesqty" Module="Core"
Type="2"><![CDATA[Number of Rating Votes]]></PHRASE>
<PHRASE Label="lu_field_createdbyid" Module="Core" Type="2"><![CDATA[Created
By User ID]]></PHRASE>
<PHRASE Label="lu_field_createdon" Module="Core" Type="2"><![CDATA[Date
Created]]></PHRASE>
<PHRASE Label="lu_field_description" Module="Core"
Type="2"><![CDATA[Description]]></PHRASE>
<PHRASE Label="lu_field_hits" Module="Core"
Type="2"><![CDATA[Hits]]></PHRASE>
<PHRASE Label="lu_field_hotitem" Module="Core" Type="2"><![CDATA[Item Is
Hot]]></PHRASE>
<PHRASE Label="lu_field_lastpostid" Module="In-Bulletin"
Type="2"><![CDATA[Last Post ID]]></PHRASE>
<PHRASE Label="lu_field_linkid" Module="Core" Type="2"><![CDATA[Link
ID]]></PHRASE>
<PHRASE Label="lu_field_manufacturer" Module="In-Commerce"
Type="2"><![CDATA[Manufacturer]]></PHRASE>
<PHRASE Label="lu_field_modified" Module="Core" Type="2"><![CDATA[Last
Modified Date]]></PHRASE>
<PHRASE Label="lu_field_modifiedbyid" Module="Core"
Type="2"><![CDATA[Modified By User ID]]></PHRASE>
<PHRASE Label="lu_field_name" Module="Core"
Type="2"><![CDATA[Name]]></PHRASE>
<PHRASE Label="lu_field_newitem" Module="Core" Type="2"><![CDATA[Item Is
New]]></PHRASE>
<PHRASE Label="lu_field_notifyowneronchanges" Module="Core"
Type="2"><![CDATA[Notify Owner of Changes]]></PHRASE>
<PHRASE Label="lu_field_orgid" Module="Core" Type="2"><![CDATA[Original Item
ID]]></PHRASE>
<PHRASE Label="lu_field_ownerid" Module="Core" Type="2"><![CDATA[Owner User
ID]]></PHRASE>
<PHRASE Label="lu_field_popitem" Module="Core" Type="2"><![CDATA[Item Is
Popular]]></PHRASE>
<PHRASE Label="lu_field_postedby" Module="In-Bulletin"
Type="2"><![CDATA[Posted By]]></PHRASE>
<PHRASE Label="lu_field_priority" Module="Core"
Type="2"><![CDATA[Priority]]></PHRASE>
<PHRASE Label="lu_field_resourceid" Module="Core" Type="2"><![CDATA[Resource
ID]]></PHRASE>
<PHRASE Label="lu_field_status" Module="Core"
Type="2"><![CDATA[Status]]></PHRASE>
<PHRASE Label="lu_field_topicid" Module="In-Bulletin"
Type="2"><![CDATA[Topic ID]]></PHRASE>
<PHRASE Label="lu_field_topictext" Module="In-Bulletin"
Type="2"><![CDATA[Topic Text]]></PHRASE>
<PHRASE Label="lu_field_url" Module="Core" Type="2"><![CDATA[URL]]></PHRASE>
<PHRASE Label="lu_of" Module="Core" Type="2"><![CDATA[of]]></PHRASE>
==========
I'll work through it to make sure LA or LU indicates where it's used and we
don't have missing phrases after we implement this functionality.
DA.