moin icon indicating copy to clipboard operation
moin copied to clipboard

New theme 'focus'

Open cintek opened this issue 2 years ago • 18 comments

As mentioned on the mailing list I would like to contribute a new theme to Moin2.

This commit shows the changes to layout.html.

Screenshot 1: Sidebar and top bar

new_theme_1

Screenshot 2: Footer

new_theme_2

cintek avatar Sep 26 '23 15:09 cintek

I have a question: How can I create a util.html that uses the util.html from templates but redefines some macros? I wasn't able to import my own file so I wrote the changed macros right into the layout.html.

cintek avatar Sep 26 '23 15:09 cintek

With the last commit I changed the appearance of the modify window for the new theme:

Modify section in new theme

cintek avatar Sep 27 '23 14:09 cintek

cintek, please make your moin repo public. It is easier to clone your repo and test all your changes than it is to review and download each diff separately.

RogerHaase avatar Sep 28 '23 20:09 RogerHaase

cintek, please make your moin repo public. It is easier to clone your repo and test all your changes than it is to review and download each diff separately.

The repo is at https://github.com/cintek/moin/tree/new-theme

wagner-intevation avatar Sep 28 '23 20:09 wagner-intevation

I marked this PR as ready for preview since now the most important work is done and it would be great to read what you think about this theme. Does is fulfill your expectations for a theme?

cintek avatar Dec 13 '23 08:12 cintek

Thanks for providing the new theme. I found some minor issues

  • on the +index page the buttons are too small for the labels:

moin_theme_focus_index

  • the name of the theme should be extended to 'Focus Theme'. Then it fits to the other themes in the user settings dialog under Appearance.
  • Can you change the PR to only contain one commit?

UlrichB22 avatar Dec 16 '23 21:12 UlrichB22

Please add your theme to: http://moinmo.in/ThemeMarket

Also check the moin2 docs to verify there is a pointer to the above theme market, and the moin2 docs have working instructions for installing a contributed theme.

RogerHaase avatar Dec 17 '23 19:12 RogerHaase

Please add your theme to: http://moinmo.in/ThemeMarket

Do you mean by that that the theme mustn't be part of the moin repository, but in a separate repository?

wagner-intevation avatar Dec 17 '23 21:12 wagner-intevation

Yes, for now. We should concentrate on fixing/improving existing code rather than adding to the code base.

Moin1.x has many contributed themes, moin 2.x should support contributed themes as well.

On Sun, Dec 17, 2023 at 2:12 PM Sebastian Wagner @.***> wrote:

Please add your theme to: http://moinmo.in/ThemeMarket

Do you mean by that that the theme mustn't be part of the moin repository, but in a separate repository?

— Reply to this email directly, view it on GitHub https://github.com/moinwiki/moin/pull/1528#issuecomment-1859285864, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGODHSK3CNFJWV4ZJUX6G3YJ5N45AVCNFSM6AAAAAA5H5Y2ZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGI4DKOBWGQ . You are receiving this because you commented.Message ID: @.***>

RogerHaase avatar Dec 18 '23 14:12 RogerHaase

Thank you for the answer.

Can themes add new translations?

wagner-intevation avatar Dec 18 '23 14:12 wagner-intevation

Not sure how a theme can add a "new translation". A theme's UI should use _('xxx') to display words and phrases, so if a new language is added all themes should support the new language without any code changes.

On Mon, Dec 18, 2023 at 7:47 AM Sebastian Wagner @.***> wrote:

Thank you for the answer.

Can themes add new translations?

— Reply to this email directly, view it on GitHub https://github.com/moinwiki/moin/pull/1528#issuecomment-1860694567, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGODHUWEKP6DYYRWTA7YTDYKBJRHAVCNFSM6AAAAAA5H5Y2ZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRQGY4TINJWG4 . You are receiving this because you commented.Message ID: @.***>

RogerHaase avatar Dec 18 '23 15:12 RogerHaase

@cintek Do you think it is enough to instead of the current proposal just display a small triangle indicating a small triangle (First is the current version of the theme, the latter is without the new translation)? I don't think it is user-friendly enough and I think we need some good idea to solve that.

image

image

wagner-intevation avatar Dec 18 '23 15:12 wagner-intevation

It should be a rare case that additional translations are required for a new theme. Maybe we can add a dummy function somewhere and include the string 'More'. For javascript there is a similar workaround with src/moin/templates/dictionary.js.

I agree that a triangle without a label is not user-friendly.

UlrichB22 avatar Dec 18 '23 20:12 UlrichB22

I finally understand issue. Focus theme invents a new word or phrase that needs translation, but contributed themes may not be present when python setup.py extract_messages is run so translation is not possible.

Maybe add a dummy procedure to end of /themes/__init__.py

def contributed_themes():
    """Contributed themes may add translation strings here"""
    Focus_theme = _("More")

RogerHaase avatar Dec 19 '23 21:12 RogerHaase

We have at least four options (I add one):

  1. Use only the triangle: I agree that this is not very user-friendly (especially because its such a small icon)
  2. Use only one icon but a different (bigger) one
    • Pro: Better than 1. because easier to see and to hit with the cursor
    • Con: Still no text
  3. Do the translation via JavaScript
    • Pro: Everything belonging to the theme is in one place
    • Con: Needs JavaScript enabled
  4. Use the function @RogerHaase mentioned: What I don't like about this solution is that the code for a contributed theme is distributed to different places - The theme with a separate repository (because it should be offered via the Theme Market) and the function which will part of the moin repository

I tend towards option 3 although it would be better if developers could just add a JSON file or something similar for translations.

cintek avatar Jan 02 '24 10:01 cintek

A fifth option is to just use _("More") in the theme code and ignore that a tiny part of the theme is English only for now. If the theme is added to the main repo at some future date, the problem is self-correcting.

I do not understand the Javascript solution - how would that work?

RogerHaase avatar Jan 02 '24 17:01 RogerHaase

Here is an example of how it could work. This way you would just need to add the attribute data-i18n to an HTML element and add a translation to the translations.js file. Of course this is a bit over-powered for just one static string so in our case I would write a shorter variant :)

cintek avatar Jan 03 '24 08:01 cintek

Two remarks:

  • We (with @cintek and @wagner-intevation ) aim to have a theme which can replace the standard default theme (because we found it lacking, so in a sense it is not about style but a usability fix to the standard interface).
  • For the translation the function seems the best solution (from what I've read).

bernhardreiter avatar Jan 16 '24 09:01 bernhardreiter