Maven Site Plugin
  1. Maven Site Plugin
  2. MSITE-41

Add a list of available language in site plugin

    Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: internationalization
    • Labels:
      None
    • Number of attachments :
      6

      Description

      Please see the attached screenshots

      This preference menu could be a list of links or a <select/> tag.
      The site descriptor needs to be updated:

      • for <select/>, by adding asSelect attribute in the menu element.
      • for links list, by adding nostrong attribute in the menu element (to not display as strong the current language and the current page)
      1. language_menu.jpg
        76 kB
        Vincent Siveton
      2. language_menu.jpg
        91 kB
        Vincent Siveton
      3. MSITE-41-doxia-sitetools.patch
        17 kB
        Yevgeny Nyden
      4. MSITE-41-maven-site-plugin.patch
        0.5 kB
        Yevgeny Nyden
      1. language_menu_as_select.jpg
        94 kB
      2. language_menu.jpg
        103 kB

        Issue Links

          Activity

          Hide
          Brett Porter added a comment -

          the first image is broken. I prefer a link list, perhaps even across the bottom of the page as that seems conventional

          Show
          Brett Porter added a comment - the first image is broken. I prefer a link list, perhaps even across the bottom of the page as that seems conventional
          Hide
          Vincent Siveton added a comment -

          Readd screenshot

          Show
          Vincent Siveton added a comment - Readd screenshot
          Hide
          Vincent Siveton added a comment -

          Readd screenshot
          tx

          Show
          Vincent Siveton added a comment - Readd screenshot tx
          Hide
          Brett Porter added a comment -

          I guess a choice of those two and perhaps the centered along the bottom option, with the links in menu option is best.

          Show
          Brett Porter added a comment - I guess a choice of those two and perhaps the centered along the bottom option, with the links in menu option is best.
          Hide
          Vincent Siveton added a comment -

          Supposed that you have this following site structure:
          +- src/
          +- site/
          +- apt/
          +- test1/
          +- index.apt
          +- index.apt
          ...
          +- fr/
          +- apt/
          +- test1/
          +- index.apt
          +- index.apt
          ...
          +- ja/
          +- apt/
          +- test1/
          +- index.apt
          +- index.apt
          ...
          +- site.xml
          +- site_fr.xml
          +- site_ja.xml

          From my point of view, from \test1\index.html for instance, we could choose default (English), French and Japanese version.

          In the maven-site-plugin code, to renderer a directory (apt, xdoc...), we are using the following plexus-site-renderer method:
          siteRenderer.render( siteDirectoryFile, outputDirectory, siteDescriptor, template, attributes, locale );
          Thus, we don't know what is the directory structure and the renderer files. So, we can't add dynamically a language link in the nav bar.
          For bottom links, it is more easiest: we could add bottom links via the Velocity template.

          How could we add dynamic links for supported languages in the nav bar? Any clues?

          Other topic: how check that a file is present in other languages (to avoid broken link)?

          Show
          Vincent Siveton added a comment - Supposed that you have this following site structure: +- src/ +- site/ +- apt/ +- test1/ +- index.apt +- index.apt ... +- fr/ +- apt/ +- test1/ +- index.apt +- index.apt ... +- ja/ +- apt/ +- test1/ +- index.apt +- index.apt ... +- site.xml +- site_fr.xml +- site_ja.xml From my point of view, from \test1\index.html for instance, we could choose default (English), French and Japanese version. In the maven-site-plugin code, to renderer a directory (apt, xdoc...), we are using the following plexus-site-renderer method: siteRenderer.render( siteDirectoryFile, outputDirectory, siteDescriptor, template, attributes, locale ); Thus, we don't know what is the directory structure and the renderer files. So, we can't add dynamically a language link in the nav bar. For bottom links, it is more easiest: we could add bottom links via the Velocity template. How could we add dynamic links for supported languages in the nav bar? Any clues? Other topic: how check that a file is present in other languages (to avoid broken link)?
          Hide
          Brett Porter added a comment -

          shouldn't the nav bar be constructed on the basis of the existence of site_*.xml files?

          for missing files, we could scan the default one and if any additional files are in there, copy them into the i18n'd version.

          Show
          Brett Porter added a comment - shouldn't the nav bar be constructed on the basis of the existence of site_*.xml files? for missing files, we could scan the default one and if any additional files are in there, copy them into the i18n'd version.
          Hide
          MD added a comment -

          I would like to have this language "switcher". Maybe there's also a possibility to use this switch via built-in language flags or something like that?!

          @Vincent: How did you integrate the languages to the default project site? I created a version with en, fr & de. Maybe you can tell me how to integrate them with the site descriptor to one central index.html.

          Thank you!

          Show
          MD added a comment - I would like to have this language "switcher". Maybe there's also a possibility to use this switch via built-in language flags or something like that?! @Vincent: How did you integrate the languages to the default project site? I created a version with en, fr & de. Maybe you can tell me how to integrate them with the site descriptor to one central index.html. Thank you!
          Hide
          Eric Chatellier added a comment -

          +1 for languages list support.

          Show
          Eric Chatellier added a comment - +1 for languages list support.
          Hide
          Yevgeny Nyden added a comment -

          Any progress on this issue? I would actually be interested in picking it up if no one's working on it... assign it to me then...

          I have a slightly different idea on how to implement this feature. You can get the idea here: http://prefcount.curre.net/ . Notice country icons on the right side in the breadcrumbs - I'm planning to make site locales available as a drop down menu. When a user switches from one locale to another, js code will try to load a page with the same name/path but from a different locale path. For example, choosing a French locale on the "site.net/ru/faq.html" page, would navigate the user to "site.net/fr/faq.html", and English (which is the default locale), would lead him/her to "site.net/faq.html", so there is an assumption here the faq.html would exist in all locale directories. I may add another way to switch between locales - navigate to the locale's index.html instead of trying to load the same path.

          Show
          Yevgeny Nyden added a comment - Any progress on this issue? I would actually be interested in picking it up if no one's working on it... assign it to me then... I have a slightly different idea on how to implement this feature. You can get the idea here: http://prefcount.curre.net/ . Notice country icons on the right side in the breadcrumbs - I'm planning to make site locales available as a drop down menu. When a user switches from one locale to another, js code will try to load a page with the same name/path but from a different locale path. For example, choosing a French locale on the "site.net/ru/faq.html" page, would navigate the user to "site.net/fr/faq.html", and English (which is the default locale), would lead him/her to "site.net/faq.html", so there is an assumption here the faq.html would exist in all locale directories. I may add another way to switch between locales - navigate to the locale's index.html instead of trying to load the same path.
          Hide
          Yevgeny Nyden added a comment -

          Depends on adding site locales data to the rendering context.

          Show
          Yevgeny Nyden added a comment - Depends on adding site locales data to the rendering context.
          Hide
          Yevgeny Nyden added a comment -

          Vincent, can you please assign this issue to me. Is there a way I can do it (reassign it) myself? Where/how?

          Show
          Yevgeny Nyden added a comment - Vincent, can you please assign this issue to me. Is there a way I can do it (reassign it) myself? Where/how?
          Hide
          Dennis Lundberg added a comment -

          You need to be in the maven-developers group to be able to get an issue assigned to you.

          If you want to work on this issue, just add a comment here and tell us.

          When you are done, attach the patch to this issue and we'll review it.

          Show
          Dennis Lundberg added a comment - You need to be in the maven-developers group to be able to get an issue assigned to you. If you want to work on this issue, just add a comment here and tell us. When you are done, attach the patch to this issue and we'll review it.
          Hide
          Yevgeny Nyden added a comment -

          Ok, I'll attach the diff when I'm ready.

          Show
          Yevgeny Nyden added a comment - Ok, I'll attach the diff when I'm ready.
          Hide
          Yevgeny Nyden added a comment -

          Dennis, to respond to a comment you made on the DOXIASITETOOLS-40 issue: "... it's a bad idea to use images of flags to represent languages. You mentioned adding images in your previous comment. See http://www.w3.org/TR/i18n-html-tech-lang/#ri20040808.173208643 ", I'd like to say that I think it's nice to have an option to use locale names as well as locale icons. Perhaps, it's even better to have icons as default, and keep the names as a build time option. What do you think?

          Show
          Yevgeny Nyden added a comment - Dennis, to respond to a comment you made on the DOXIASITETOOLS-40 issue: "... it's a bad idea to use images of flags to represent languages. You mentioned adding images in your previous comment. See http://www.w3.org/TR/i18n-html-tech-lang/#ri20040808.173208643 ", I'd like to say that I think it's nice to have an option to use locale names as well as locale icons. Perhaps, it's even better to have icons as default, and keep the names as a build time option. What do you think?
          Hide
          Dennis Lundberg added a comment -

          Yevgeny, when you say "locale icons" do you mean images of flags for different countries?
          If so, then I would be opposed to adding those.

          The best way is to use the Locale objects and extract the information from there. I see two options for what to put in a drop-down menu.

          1. Use the 2-letter language codes as defined in ISO 639-1. "en" for English, "fr" for French, "de" for German etc.

          2. Use the name of the language, written in the current language of the site you are viewing. If you are looking at an English page the names of the languages would be written in English. "German", "Spanish" and "French" for example. If the page is in German, you would use values like "Deutsch", "Spanisch" and "Französisch" instead. It is possible to get this information using the Locale objects. The l10n Plugin uses some of those features.

          Show
          Dennis Lundberg added a comment - Yevgeny, when you say "locale icons" do you mean images of flags for different countries? If so, then I would be opposed to adding those. The best way is to use the Locale objects and extract the information from there. I see two options for what to put in a drop-down menu. 1. Use the 2-letter language codes as defined in ISO 639-1. "en" for English, "fr" for French, "de" for German etc. 2. Use the name of the language, written in the current language of the site you are viewing. If you are looking at an English page the names of the languages would be written in English. "German", "Spanish" and "French" for example. If the page is in German, you would use values like "Deutsch", "Spanisch" and "Französisch" instead. It is possible to get this information using the Locale objects. The l10n Plugin uses some of those features.
          Hide
          Yevgeny Nyden added a comment -

          Dennis, sorry for confusion, yes, I meant the country icons. I see your point now, so I'll use language names (or 2-letter codes) instead - these values are available on the locale's java.util.Locale object. Although I still wish there would be a way to represent them graphically.

          Show
          Yevgeny Nyden added a comment - Dennis, sorry for confusion, yes, I meant the country icons. I see your point now, so I'll use language names (or 2-letter codes) instead - these values are available on the locale's java.util.Locale object. Although I still wish there would be a way to represent them graphically.
          Hide
          Yevgeny Nyden added a comment -

          Dennis, or in fact, anybody who's interested, please take a look at the proposed feature here:

          http://curre.net/mvn-site/

          What browser should we support? I tested this in IE8, FF3.6 (on Mac), and Safari 5 (on Mac), but I think it should work just fine in other browsers as well.

          I will submit the diff for review after your feedback.

          Show
          Yevgeny Nyden added a comment - Dennis, or in fact, anybody who's interested, please take a look at the proposed feature here: http://curre.net/mvn-site/ What browser should we support? I tested this in IE8, FF3.6 (on Mac), and Safari 5 (on Mac), but I think it should work just fine in other browsers as well. I will submit the diff for review after your feedback.
          Hide
          Dennis Lundberg added a comment - - edited

          One minor detail. The language codes should be in lower case: en, fr and ru.

          Is it possible to choose where on the page the language selector is placed, in the same way that you can for the version?

          For browser support, is it the Javascript that you are worried about?

          Show
          Dennis Lundberg added a comment - - edited One minor detail. The language codes should be in lower case: en, fr and ru. Is it possible to choose where on the page the language selector is placed, in the same way that you can for the version? For browser support, is it the Javascript that you are worried about?
          Hide
          Yevgeny Nyden added a comment -

          Sure, I'll make it lower case. I think it looks better in caps though.

          Tested more on Windows today - yeah, I just want to be sure about js and css. Still need to get to IE6.

          What place choices do you think should be available?

          Show
          Yevgeny Nyden added a comment - Sure, I'll make it lower case. I think it looks better in caps though. Tested more on Windows today - yeah, I just want to be sure about js and css. Still need to get to IE6. What place choices do you think should be available?
          Hide
          Vincent Siveton added a comment -

          Under the "Project Documentation" and before the built by logo.

          Show
          Vincent Siveton added a comment - Under the "Project Documentation" and before the built by logo.
          Hide
          Yevgeny Nyden added a comment -

          OK, I'll try to make 3 placement options available:

          1) breadcrumbs right (current);
          2) breadcrumbs left;
          3) right before the BUILD logo.

          The default will be (1).

          Show
          Yevgeny Nyden added a comment - OK, I'll try to make 3 placement options available: 1) breadcrumbs right (current); 2) breadcrumbs left; 3) right before the BUILD logo. The default will be (1).
          Hide
          Yevgeny Nyden added a comment -

          I added all available position options: left, right, navigation-top, navigation-bottom, bottom, so that the same positioning is avalable for i18nBanner, version, and release date.

          UI test is available here: http://sandbox.curre.net/mvn-site/0 (replace 0 with 1, 2... 5 to see other layout versions). Tested it on FF, Chrome, Safari, and IE7, 8. Is there an official statement on supported browsers? Btw, I wouldn't care about IE6 at this point.

          Note to self (and just so you know):
          I indent to do more work on this:

          1) internationalize the title string on the i18nBannerLink;
          2) add an image to i18nBannerLink;
          3) refactor the publishDate template (it's a mess right now), which will probably remove all IE7 hacks I added;
          4) make sure skins support the new i18nBanner;
          5) write site documentation/example on how to configure i18n;
          6) add unit tests to test the new feature.

          Anything else I missed?

          Is there somebody who can help me with some of these (e.g. documentation)?

          Show
          Yevgeny Nyden added a comment - I added all available position options: left, right, navigation-top, navigation-bottom, bottom, so that the same positioning is avalable for i18nBanner, version, and release date. UI test is available here: http://sandbox.curre.net/mvn-site/0 (replace 0 with 1, 2... 5 to see other layout versions). Tested it on FF, Chrome, Safari, and IE7, 8. Is there an official statement on supported browsers? Btw, I wouldn't care about IE6 at this point. Note to self (and just so you know): I indent to do more work on this: 1) internationalize the title string on the i18nBannerLink; 2) add an image to i18nBannerLink; 3) refactor the publishDate template (it's a mess right now), which will probably remove all IE7 hacks I added; 4) make sure skins support the new i18nBanner; 5) write site documentation/example on how to configure i18n; 6) add unit tests to test the new feature. Anything else I missed? Is there somebody who can help me with some of these (e.g. documentation)?
          Hide
          Vincent Siveton added a comment -

          http://sandbox.curre.net/mvn-site/2 or http://sandbox.curre.net/mvn-site/4/ could be the default IMHO.

          I will review it and commit soon.

          Show
          Vincent Siveton added a comment - http://sandbox.curre.net/mvn-site/2 or http://sandbox.curre.net/mvn-site/4/ could be the default IMHO. I will review it and commit soon.
          Hide
          Lukas Theussl added a comment -

          This will have to be revisited after MSITE-322. Different language sites are now deployed into their own tree like eg

          main
           index.html
           submodule/index.html
          
           fr/index.html
           fr/submodule/index.html
          

          Before it was:

          main
           index.html
           fr/index.html
          
           submodule/index.html
           submodule/fr/index.html
          

          so switching between language sites, the relative links have changed.

          Show
          Lukas Theussl added a comment - This will have to be revisited after MSITE-322 . Different language sites are now deployed into their own tree like eg main index.html submodule/index.html fr/index.html fr/submodule/index.html Before it was: main index.html fr/index.html submodule/index.html submodule/fr/index.html so switching between language sites, the relative links have changed.

            People

            • Assignee:
              Unassigned
              Reporter:
              Vincent Siveton
            • Votes:
              6 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: