Bug 206510 - enable contribution/configuration of language settings
Summary: enable contribution/configuration of language settings
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 2.2   Edit
Assignee: Frank Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 209132 (view as bug list)
Depends on:
Blocks: 209132
  Show dependency tree
 
Reported: 2007-10-16 14:18 EDT by Robert Elves CLA
Modified: 2011-09-30 13:44 EDT (History)
2 users (show)

See Also:


Attachments
new version of templates.exsd (3.87 KB, patch)
2007-10-21 21:16 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (5.68 KB, application/octet-stream)
2007-10-21 21:16 EDT, Frank Becker CLA
no flags Details
mylyn/context/zip (1.74 KB, application/octet-stream)
2007-10-23 18:40 EDT, Robert Elves CLA
no flags Details
patch with new Language extention (41.76 KB, patch)
2007-10-30 19:10 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (25.61 KB, application/octet-stream)
2007-10-30 19:10 EDT, Frank Becker CLA
no flags Details
changed patch (44.88 KB, patch)
2007-11-01 16:44 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (29.83 KB, application/octet-stream)
2007-11-01 16:44 EDT, Frank Becker CLA
no flags Details
Updated patch (47.06 KB, patch)
2007-11-01 20:01 EDT, Robert Elves CLA
no flags Details | Diff
New Version of Patch (41.78 KB, patch)
2007-11-17 17:15 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (7.53 KB, application/octet-stream)
2007-11-17 17:15 EST, Frank Becker CLA
no flags Details
followup patch (7.25 KB, patch)
2007-12-01 17:48 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (10.48 KB, application/octet-stream)
2007-12-01 17:48 EST, Frank Becker CLA
no flags Details
new patch (7.25 KB, patch)
2007-12-04 17:37 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (10.97 KB, application/octet-stream)
2007-12-04 17:37 EST, Frank Becker CLA
no flags Details
cleanup (1006 bytes, patch)
2007-12-05 00:18 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (11.02 KB, application/octet-stream)
2007-12-05 00:18 EST, Frank Becker CLA
no flags Details
patch of BugzillaTaskHistoryParser (3.33 KB, patch)
2007-12-06 16:22 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (1.59 KB, application/octet-stream)
2007-12-06 16:22 EST, Frank Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Elves CLA 2007-10-16 14:18:56 EDT
Mik suggested using the templates mechanism (RepositoryTemplate).  If we did this then a plugin could be provided that simply contributes a template for at particular repository along with the appropriate language. The language could be a sub element of the template extension point. 

Franks Comments from bug#173352
* If this is the enduser who is not a bugzilla admin then I think a preference page or a button in the BugzillaRepositorySettingPage. The same in someone use a Bugzilla which has localized templates.
* If you think that Mylyn should set up  all the language settings for the localized bugzilla templates (actually 17) with more then one available versions then I think the templates mechanism should be used.
Comment 1 Frank Becker CLA 2007-10-21 21:16:03 EDT
Created attachment 80843 [details]
new version of templates.exsd

Question to emplates.exsd

1)  is it what you expected that language is an sequence to the extention

or

2) should language be an sequence to the repository element

Result

1) let you define an language for all bugzilla repositories but hen you need an new attribute (languageChoice) to say what language you want to Choice.

It is possible to an a new repository via popup menu 'Add Task Repository'.

2) It exists only one language settings per repository. But I see no way how to add a new repository with language settings via popup menu 'Add Task Repository'.

Is it right that 1) is the way to go one?

If yes then should we move BugzillaLanguageSettings from BugzillaCorePlugin to BugzillaRepositoryConnector?


BTW Should we do some cleanup on BugzillaLanguageSettings? To me it looks like invalid is only used with password so I think why not use 'Invalid Username Or Password' from bugzilla template/en/default/global/user-error.html.tmpl. Maybe ohters can change in the same way.
Comment 2 Frank Becker CLA 2007-10-21 21:16:15 EDT
Created attachment 80844 [details]
mylyn/context/zip
Comment 3 Robert Elves CLA 2007-10-23 18:39:23 EDT
I think (1) is the way to go here and the language extension point could have a connector kind field. Language templates as you suggest should be migrated to the connector (much like RepositoryTemplate).  Mik, perhaps these is a better baby step here before moving into the frame work though?

Regarding cleanup of BugzillaLanguageSettings, perhaps the template should consist of a token name like 'login' which maps to a sequence of acceptable variants (rather than having to have login2 like I added).
Comment 4 Robert Elves CLA 2007-10-23 18:40:30 EDT
Created attachment 81009 [details]
mylyn/context/zip

Some pointers...
Comment 5 Frank Becker CLA 2007-10-25 14:57:34 EDT
 (In reply to comment #3)

> Regarding cleanup of BugzillaLanguageSettings, perhaps the template should
> consist of a token name like 'login' which maps to a sequence of acceptable
> variants (rather than having to have login2 like I added).

What do you think about the following implementation

Sequence of Strings for the following entries
- RepositoryStatus.ERROR_REPOSITORY_LOGIN
- RepositoryStatus.REPOSITORY_COLLISION
- RepositoryStatus.REPOSITORY_COMMENT_REQUIRED
- RepositoryStatus.REPOSITORY_LOGGED_OUT
- BugzillaTaskHistoryParser.possibleBadLogin

for RepositoryStatus.ERROR_REPOSITORY_LOGIN and BugzillaTaskHistoryParser.possibleBadLogin we must change the and condition of "Invalid" and "Password" to match on string.  This can be 'Invalid Username Or Password'

The Result for 'en' and 'de' can look like
possibleBadLogin									en = "Login", "check e-mail", "Invalid Username Or Password", "error"
																	de = "Anmeldename erforderlich", "check e-mail", "Ungütiger Benutzername oder ungültiges Passwort", "error"

ERROR_REPOSITORY_LOGIN					en = "Login", "log in", "check e-mail", "Invalid Username Or Password"
																	de = "Anmeldename erforderlich", "check e-mail", "Ungütiger Benutzername oder ungültiges Passwort"

REPOSITORY_COLLISION						en = "Mid-air collision!"
																	de = "Kollision!"
REPOSITORY_COMMENT_REQUIRED		en = "Comment Required"
																	de = "Kommentar erforderlich"
REPOSITORY_LOGGED_OUT					en = "logged out"
																	de = "Abgemeldet"

Should I go and implement it like this 

Rob can you tell me what was the errorsituation for login2. I can not find it in the bugzilla templates within a titel
Comment 6 Frank Becker CLA 2007-10-30 19:10:52 EDT
Created attachment 81664 [details]
patch with new Language extention

some points

- is it Ok to extend BugzillaCorePlugin to access AbstractRepositoryConnector or is there a better way?

- I only ad on test for the english version of invalid user or password. Is it possible to have an bugzilla installation with germzilla for testing?

- I think the definition of languages from extentionpoint is finished. What is next? Should we allow other ways of configuration and how to sync them?
Comment 7 Frank Becker CLA 2007-10-30 19:10:56 EDT
Created attachment 81665 [details]
mylyn/context/zip
Comment 8 Frank Becker CLA 2007-11-01 16:44:17 EDT
Created attachment 81883 [details]
changed patch

I add testMidAirCollision and do some cleanup
Comment 9 Frank Becker CLA 2007-11-01 16:44:24 EDT
Created attachment 81884 [details]
mylyn/context/zip
Comment 10 Robert Elves CLA 2007-11-01 20:01:53 EDT
Created attachment 81907 [details]
Updated patch

This is really great stuff Frank.  I just have some tests failing when running all bugzilla tests so we need to look into this. Once the tests are passing we can apply this and then consider the refinements.  I'm posting an updated version of your patch to work from.  We can iterate on this and get into next weeks build.
Comment 11 Frank Becker CLA 2007-11-02 03:56:18 EDT
 (In reply to comment #10)
> Created an attachment (id=81907)
> Updated patch
> 
> This is really great stuff Frank.  I just have some tests failing when running
> all bugzilla tests so we need to look into this. Once the tests are passing we
> can apply this and then consider the refinements.  I'm posting an updated
> version of your patch to work from.  We can iterate on this and get into next
> weeks build.
Hi Rob,
sorry for the failing of some tests. Over the weekend I will look at this and give you an version in which all test get green.
Comment 12 Robert Elves CLA 2007-11-02 12:17:44 EDT
No worries Frank, some of the BugzillaRepositoryConnectorTest failures are unrelated to your patch.
Comment 13 Frank Becker CLA 2007-11-02 16:41:13 EDT
 (In reply to comment #12)
> No worries Frank, some of the BugzillaRepositoryConnectorTest failures are
> unrelated to your patch.
Thats right but the testReassign tests get failed to so a reset them to the default assignee.
Comment 14 Frank Becker CLA 2007-11-15 15:03:35 EST
 (In reply to comment #10)
> This is really great stuff Frank.  I just have some tests failing when running
> all bugzilla tests so we need to look into this. Once the tests are passing we
> can apply this and then consider the refinements.  I'm posting an updated
> version of your patch to work from.  We can iterate on this and get into next
> weeks build.

Hi Rob,

can I help here?
Comment 15 Robert Elves CLA 2007-11-15 15:41:46 EST
I have all tests passing now so will look at this again. Sorry for the delay.
Comment 16 Robert Elves CLA 2007-11-15 16:43:14 EST
After talking to Mik about this I realize we have to move the implementation back within the Bugizilla component. Since languages as the a Bugzilla implementation detail it should remain a Bugzilla specific capability.  This should be a simple refactoring i.e. moving extension point and moving AbstractRepositoryConnector code to BugzillaRepositoryConnector etc.  Wrt the extension point, ideally it should be a sequence of languageAttributes along the lines of:

   <element name="languageAttribute">
      <complexType>
         <attribute name="command" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="response" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
      </complexType>
   </element>

   
   Then the extension point reader would read in all these command/response pairs which are then held by LanguageSettings (move back into bugzilla).  The trick will then be knowing which command to get the response string for so each command may need a constant.  I apologize for not catching this sooner Frank. 
Comment 17 Frank Becker CLA 2007-11-17 17:15:50 EST
Created attachment 83165 [details]
New Version of Patch

Some Comments.

1) testSubTaskHasIncoming fails because since 2007-11-16 14:43:05 bug 8 was removed from the Depends on list so task.getChildren().size() returns 1.

2) I think we should do some clean up of the command/responce entry. By example I can not find "check e-mail" in any title, so we can remove it.

3) Describe where in the bugzilla "en" template the responce strings so it is easy to found them in the localized versions.

BTW I also found that the Title was not correctly calculated.
Comment 18 Frank Becker CLA 2007-11-17 17:15:53 EST
Created attachment 83166 [details]
mylyn/context/zip
Comment 19 Robert Elves CLA 2007-11-30 14:15:11 EST
Great stuff here Frank. Patch applied and ip log have been updated. Lets leave 'check e-mail' as this may be returned by an older repository. I fixed (1) and I'm not certain I understand point (3).    My only outstanding concern here is that BugzillaRepositoryConnector.getLanguageSetting() can return null.  In the case of headless usage of this api things will not work unless a language is manually specified (I'll need to document this on the wiki).  Ideally this would return the 'en' template however this would require a hard coded version of this class.  Thoughts?
Comment 20 Frank Becker CLA 2007-11-30 15:52:23 EST
 (In reply to comment #19)
> Great stuff here Frank. Patch applied and ip log have been updated. Lets leave
> 'check e-mail' as this may be returned by an older repository. I fixed (1) and
> I'm not certain I understand point (3). 
Ok try to explain this in detail.
If we by example document that the value "Mid-air collision!" is the String defined as an title in file bugzilla-2.18.6/template/en/default/bug/process/header.html.tmpl line 31. Then for translate the String to german we must only look in file  bugzilla-2.18.6/template/de/default/bug/process/header.html.tmpl
fo find the translate of line 31.

>  My only outstanding concern here is
> that BugzillaRepositoryConnector.getLanguageSetting() can return null.  In the
> case of headless usage of this api things will not work unless a language is
> manually specified (I'll need to document this on the wiki).  Ideally this would
> return the 'en' template however this would require a hard coded version of this
> class.  Thoughts?

What is if we hard code the en version and only use addLanguageAttribute for the translated versions.

One other thing.
There is a problem with charactersets. The content of org.eclipse.mylyn.bugzilla.ui plugin.xml that I get from the repository
<languageAttribute command="error_login" 				response="Ungütiger Benutzername oder ungültiges Passwort"/>

but the response should be response="Ungültiger Benutzername oder ungültiges Passwort"
Comment 21 Robert Elves CLA 2007-11-30 17:00:27 EST
 (In reply to comment #20)
> (In reply to comment #19)
> > Great stuff here Frank. Patch applied and ip log have been updated. Lets leave
> > 'check e-mail' as this may be returned by an older repository. I fixed (1) and
> > I'm not certain I understand point (3).
> Ok try to explain this in detail.
> If we by example document that the value "Mid-air collision!" is the String
> defined as an title in file
> bugzilla-2.18.6/template/en/default/bug/process/header.html.tmpl line 31. Then
> for translate the String to german we must only look in file
> bugzilla-2.18.6/template/de/default/bug/process/header.html.tmpl
> fo find the translate of line 31.

We could document this on a link from http://wiki.eclipse.org/Mylyn_Bugzilla_Connector
 
> What is if we hard code the en version and only use addLanguageAttribute for the
> translated versions.

Yes this sounds like the right way to go, and if we make BugzillaLanguageTemplate override equals and hash code and base equality on the language name the 'en' hard coded template could be overridden if desired by providing a new 'en' template via extension point.
 
> One other thing.
> There is a problem with charactersets. The content of
Apparently the create patch functionality doesn't support UTF-8. This should now be fixed in head.
Comment 22 Frank Becker CLA 2007-12-01 17:48:49 EST
Created attachment 84265 [details]
followup patch

 (In reply to comment #21)
> 
>We could document this on a link from http://wiki.eclipse.org/Mylyn_Bugzilla_Connector
If you think it is up to me to do this I need a little more information. And after I edit be so kind and properly correct my not so perfect english.
>
> Yes this sounds like the right way to go, and if we make
> BugzillaLanguageTemplate override equals and hash code and base equality on the
> language name the 'en' hard coded template could be overridden if desired by
> providing a new 'en' template via extension point.

What do you think to have "en (builtin)" and not to deal with hash code?
Comment 23 Frank Becker CLA 2007-12-01 17:48:52 EST
Created attachment 84266 [details]
mylyn/context/zip
Comment 24 Robert Elves CLA 2007-12-04 12:29:55 EST
 (In reply to comment #22)
> >We could document this on a link from
> http://wiki.eclipse.org/Mylyn_Bugzilla_Connector
> If you think it is up to me to do this I need a little more information. And
> after I edit be so kind and properly correct my not so perfect english.

I may have miss understood.  Do you mean to automatically parse the template to decipher the returned strings?


> >
> > Yes this sounds like the right way to go, and if we make
> > BugzillaLanguageTemplate override equals and hash code and base equality on
> the
> > language name the 'en' hard coded template could be overridden if desired by
> > providing a new 'en' template via extension point.
> 
> What do you think to have "en (builtin)" and not to deal with hash code?

"en (default)" could work
Comment 25 Eugene Kuleshov CLA 2007-12-04 12:44:18 EST
By the way, guys don't you think it will be better to use property files, so this i18n-related stuff won't be encoded inside plugin.xml? It will also have advantage of editing these settings independently.
Comment 26 Robert Elves CLA 2007-12-04 12:59:12 EST
I think we're safe with this if we're encoding in utf-8.
Comment 27 Frank Becker CLA 2007-12-04 17:17:20 EST
 (In reply to comment #24)
> (In reply to comment #22)
> > >We could document this on a link from
> > http://wiki.eclipse.org/Mylyn_Bugzilla_Connector
> > If you think it is up to me to do this I need a little more information. And
> > after I edit be so kind and properly correct my not so perfect english.
> 
> I may have miss understood.  Do you mean to automatically parse the template to
> decipher the returned strings?

No I don't think that automaticlly is right. I would like to describe this like a cokbook. That mens what are the steps do add an actually not supported language.

BTW  If we want to do that does that meen that we have to do somethink like a Eclipse-RegisterBuddy: to allow the definition of a new laguagesetting

Comment 28 Frank Becker CLA 2007-12-04 17:37:36 EST
Created attachment 84464 [details]
new patch

change en (builtin) to en (default)
Comment 29 Frank Becker CLA 2007-12-04 17:37:40 EST
Created attachment 84465 [details]
mylyn/context/zip
Comment 30 Robert Elves CLA 2007-12-04 21:58:37 EST
Patch applied with the following changes:  I extracted the constant to IBugzillaConstants.DEFAULT_LANG and removed dead code from RepositoryTemplate. Had to override hashcode and equals to ensure we don't get duplicate languages.  Updated BugzillaRepositoryConnector.getLanguageSetting() to return the default language rather than null.  Removed 'en' template from plugin.xml to avoid duplication in ui.

Ip log updated.

 (In reply to comment #27)
> No I don't think that automaticlly is right. I would like to describe this like
> a cokbook. That mens what are the steps do add an actually not supported
> language.

Cookbook style entry on the wiki page I mentioned would be great for this.

> BTW  If we want to do that does that meen that we have to do somethink like a
> Eclipse-RegisterBuddy: to allow the definition of a new laguagesetting
This should just be a matter of extending the "org.eclipse.mylyn.bugzilla.core.languages" extension point and your extension point reader will do the rest.  You could document this as well on that wiki page.


Marking resolved...
Comment 31 Frank Becker CLA 2007-12-05 00:18:44 EST
Created attachment 84482 [details]
cleanup

I correct the decription of public BugzillaLanguageSettings getLanguageSetting(String label). 

(In reply to comment #30)
> (In reply to comment #27)
> > No I don't think that automaticlly is right. I would like to describe this
> like
> > a cokbook. That mens what are the steps do add an actually not supported
> > language.
> 
> Cookbook style entry on the wiki page I mentioned would be great for this.

I never edit a wiki page before. Please tell me what to do and I start with this tonigth.
> 
> > BTW  If we want to do that does that meen that we have to do somethink like a
> > Eclipse-RegisterBuddy: to allow the definition of a new laguagesetting
> This should just be a matter of extending the
> "org.eclipse.mylyn.bugzilla.core.languages" extension point and your extension
> point reader will do the rest.  You could document this as well on that wiki
> page.
>
Comment 32 Frank Becker CLA 2007-12-05 00:18:50 EST
Created attachment 84483 [details]
mylyn/context/zip
Comment 33 Robert Elves CLA 2007-12-05 12:55:05 EST
Patch applied ip log updated.

To edit the wiki, just go to http://wiki.eclipse.org/Mylyn_Bugzilla_Connector and click 'Edit' in the menu on the left. You will be asked to login.  Use your bugzilla email and passwd to login. For some reason you sometimes have to capitalize the first character of your user name to log in.

For wiki syntax see http://en.wikipedia.org/wiki/Wikipedia:How_to_edit_a_page   Don't worry too much about layout though.
Comment 34 Frank Becker CLA 2007-12-06 16:19:21 EST
Sorry,

I found that I have not changed the retrieveHistory Method in BugzillaTaskHistoryParser so a other patch is needed.
Comment 35 Frank Becker CLA 2007-12-06 16:22:47 EST
Created attachment 84669 [details]
patch of BugzillaTaskHistoryParser

see Comment #34
Comment 36 Frank Becker CLA 2007-12-06 16:22:57 EST
Created attachment 84670 [details]
mylyn/context/zip
Comment 37 Robert Elves CLA 2007-12-06 19:31:11 EST
Good catch. Patch applied, ip log updated. Feel free to mark this one resolved Frank.
Comment 38 Frank Becker CLA 2007-12-07 01:37:34 EST
 (In reply to comment #33)
> Patch applied ip log updated.
> 
> To edit the wiki, just go to http://wiki.eclipse.org/Mylyn_Bugzilla_Connector
> and click 'Edit' in the menu on the left. You will be asked to login.  Use your
> bugzilla email and passwd to login. For some reason you sometimes have to
> capitalize the first character of your user name to log in.
>

Have you seen waht I insert in http://wiki.eclipse.org/Mylyn_Bugzilla_Connector ?

Any comments?

Comment 39 Robert Elves CLA 2007-12-07 23:32:02 EST
I had a look Frank and this looks perfect!
Comment 40 Frank Becker CLA 2007-12-08 10:41:18 EST
After http://wiki.eclipse.org/Mylyn_Bugzilla_Connector is OK,

I think we can close this one.
Comment 41 Frank Becker CLA 2007-12-09 07:44:33 EST
Now realy closed.
Comment 42 Robert Elves CLA 2007-12-10 14:19:41 EST
Great job on this and the documentation Frank.
Comment 43 Frank Becker CLA 2011-09-30 13:44:36 EDT
*** Bug 209132 has been marked as a duplicate of this bug. ***