Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation of duente custom menus #3

Open
Normand-Nadon opened this issue Nov 23, 2022 · 19 comments
Open

Translation of duente custom menus #3

Normand-Nadon opened this issue Nov 23, 2022 · 19 comments

Comments

@Normand-Nadon
Copy link

Do you provide a way to translate words used in your menus (as they are not covered by the base template)

image

image

Thank you!

@sakis-tech
Copy link

sakis-tech commented Nov 23, 2022

You can change that as follows.

In the Admin CP you click on "Templates & Style" > "Templates" > "Duende v3 (Local) Templates" > "Header Templates" and then on "header"

You can then change anything there.
Here is an example of how I have it (you can change the ones marked in yellow"
grafik

You can change the other under "header_welcomeblock_guest".

@melroy89
Copy link
Owner

Correct

@melroy89 melroy89 reopened this Nov 23, 2022
@melroy89
Copy link
Owner

Or you mean you couldn't find this register button in your html?

@Normand-Nadon
Copy link
Author

SO if I get you right, the translation lives in the template? will I be able to switch between english and french after that?
Or is that hardcoded?

@melroy89
Copy link
Owner

SO if I get you right, the translation lives in the template? will I be able to switch between english and french after that? Or is that hardcoded?

Some of those buttons are hard coded indeed. Because there is no language text available in mybb I could re-use. Meaning all the template changes are final and once changed they are that language you now translating to.

@Normand-Nadon
Copy link
Author

Normand-Nadon commented Nov 23, 2022

Some of those buttons are hard coded indeed. Because there is no language text available in mybb I could re-use. Meaning all the template changes are final and once changed they are that language you now translating to.

I fixed the issue by using MyBB global variables! I am leaving it here :)

I will work further on the solution and make a later pull request to your repo if you agree

<div id="cssmenu">
  <ul>
      <li><a href="{$mybb->settings['bburl']}"><span><i style="font-size: 14px;" class="fa fa-home fa-fw"></i> {$lang->forumjump_home}</span></a></li>
      <li><a href="{$mybb->settings['bburl']}/portal.php"><i style="font-size: 14px;" class="fa fa-tachometer fa-fw"></i>  {$lang->toplinks_portal}</a></li>
      <li><a href="{$mybb->settings['bburl']}/search.php"><i style="font-size: 14px;" class="fa fa-search fa-fw"></i>  {$lang->toplinks_search}</a></li>
	  <li><a href="{$mybb->settings['bburl']}/memberlist.php"><i style="font-size: 14px;" class="fa fa-user fa-fw"></i> {$lang->toplinks_memberlist}</a></li>
      <li><a href="{$mybb->settings['bburl']}/calendar.php"><i style="font-size: 14px;" class="fa fa-calendar fa-fw"></i>  {$lang->toplinks_calendar}</a></li>
	  <li><a href="{$mybb->settings['bburl']}/search.php?action=getdaily&days=50000"><i style="font-size: 14px;" class="fa fa-bell fa-fw"></i> {$lang->latest_threads}</a></li>
      <li><a href="{$mybb->settings['bburl']}/search.php?action=getdaily"><i style="font-size: 14px;" class="fa fa-star fa-fw"></i> {$lang->welcome_todaysposts}</a></li>
	  <li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><i style="font-size: 14px;" class="fa fa-life-ring fa-fw"></i> {$lang->toplinks_help}</a></li>
  </ul>
</div>

@Normand-Nadon
Copy link
Author

I was able to create translations for the "Messages" drop-down menu, but it involves modifying the global.lang.php file...

The variables in this sub-menu are used inside the scope of the usercp context and can't be reached by the navbar...

@Danger89, I need you opinion on that: Those menu items were not meant to be called from outside the usercp context, and they mostly all open the same view, with filters. Don't you think we should simply remove the drop-down for safety reasons?

image

Same goes for the user drop-down... some of the options in the theme are not meant to be accessed from the navbar (and could override some permissions on the forum even!)

@Normand-Nadon
Copy link
Author

Normand-Nadon commented Nov 24, 2022

I did a lot of work on the template today, and even fixed some bugs (my php/css is a little rusty, but I managed to make it work!)

  • Replaced all harcoded text I cloud find with mybb $lang variables, when possible
  • Added the language switcher at the bottom and made sure it does not interfere with the theme switcher
  • Removed the "User" pop-up menu and put it on the avatar instead
  • Removed some stuff in the Avatar/user menu and only kept what was in the right context
  • Made sure that the Avatar still shows when the user does not have one and the default is used instead (failsafe needed)
  • Changed translations on the guest header
  • Fixed some layout issues

Let me know what you think... I still think the Private Messages menu should not be a menu, instead just a link

Tomorrow, I am going to try to make the "0 unread" background transparent, unless the amount is 1 or more

image

image

image

@melroy89
Copy link
Owner

That looks very good. You are free to export the theme from mybb incl stylesheet + template. Which I will use to create a new new version!

@sakis-tech
Copy link

sakis-tech commented Dec 18, 2022

I was inspired by @Normand-Nadon and experimented a little bit. :)

This was the result:

grafik

grafik

grafik

changes:

header_welcomeblock_member

<span class="hide" style="color:#fff;"> {$lang->welcome_back} </span> &nbsp; 
&nbsp; 
<span class="dropdown">
	<a class="white" data-toggle="dropdown" href="#"><font color="#fff"><i class="fa fa-envelope-o fa-2x" aria-hidden="true"></i></font></a>
        <a id="pm_notification" href="private.php?fid=1" title="Ungelesene Nachrichten"> {$mybb->user['pms_unread']}</a>
	<ul class="dropdown-menu bullet pull-center notification animated fadeIn faster" role="menu" aria-labelledby="dLabel">	  
		<li role="presentation"><a href="private.php?fid=1"> Posteingang </a> </li>	
		<li role="presentation"><a href="private.php?action=send"> Neue Nachricht  </a></li>
		<li role="presentation"><a href="private.php?fid=2"> Gesendeten Nachrichten </a></li>
		<li role="presentation"><a href="private.php?action=tracking"> Nachrichten verfolgen </a></li>
	</ul>
</span>
&nbsp; 
&nbsp; 
&nbsp;
<span class="dropdown">
	<a class="header_avatar" data-toggle="dropdown" href="#"><font color="#fff"><img style="vertical-align: bottom; border-radius: 55%; transition:all 0.3s ease;" src="{$mybb->user['avatar']}" height="35px" width="35px" class="miniav"/></font></a>
	<ul class="dropdown-menu bullet pull-center notification animated fadeIn faster" role="menu" aria-labelledby="dLabel">	  
		<li role="presentation"><a href="{$mybb->settings['bburl']}/usercp.php"> Benutzer-CP </a></li>
		<li role="presentation"><a href="{$mybb->settings['bburl']}/usercp.php?action=profile"> Profil bearbeiten </a></li>
		<li role="presentation"><a href="{$mybb->settings['bburl']}/usercp.php?action=options"> Optionen bearbeiten </a></li>
		<li role="presentation"><a href="{$mybb->settings['bburl']}/usercp.php?action=editsig"> Signatur bearbeiten </a></li>
		<li role="presentation"><a href="{$mybb->settings['bburl']}/usercp.php?action=editlists"> Freundesliste </a></li>
		<li role="presentation"><a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}"> Ausloggen </a></li>
		{$modcplink}
		{$admincplink}
	</ul>
</span>

duendev3.css

#pm_notification {
  top: -5px;
  left: 100%;
  transform: translateX(-50%);
  position: absolute;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #dc3545;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

and

.open>.dropdown-menu {
	margin-top: 5px;
	box-shadow: rgba(50,50,93,0.25) 0px 2px 5px -1px,rgba(0,0,0,0.3) 0px 1px 3px -1px;
	left: 50%;
	transform: translateX(-50%);
	display: inline-block;
}

@Normand-Nadon were you able to solve the problem with the transparent background when there are "0 messages"?

@Normand-Nadon
Copy link
Author

@sakis-tech
Not yet, I had to push this project aside for a while...
Kids got sick (flu and gastroenteritis) one after the other and then one of them broke his foot!
Let's just say that between that and my daytime job, I ran-out of time!

I wish to finish it during the holidays though... I will send the results.

I like your envelope thingy... where did you get it? is it already in the template?

@Normand-Nadon
Copy link
Author

Normand-Nadon commented Dec 24, 2022

@sakis-tech
BTW, this is exactly the part I am trying to avoid... There should not be plain text translations in the template... We should use the system variables instead, so that pre-built translations work out-of-the-box
image

This is how I fixed it on my version:

<span class="dropdown">
	<a class="white" data-toggle="dropdown" href="#"><font color="#fff"><strong>  {$lang->welcome_pms} </strong>  <i style="font-size: 10px; vertical-align: middle;" class="fa fa-chevron-down fa-fw"></i></font></a>
	<ul class="dropdown-menu bullet pull-right notification animated fadeIn faster" role="menu" aria-labelledby="dLabel">
		<li role="presentation"><a href="private.php?fid=1"> {$lang->duente_pm_inbox} </a> </li>	
		<li role="presentation"><a href="private.php?action=send"> {$lang->duente_pm_send} </a></li>
		<li role="presentation"><a href="private.php?fid=2"> {$lang->duente_pm_sent} </a></li>
		<li role="presentation"><a href="private.php?action=tracking"> {$lang->duente_pm_track} </a></li>		
	</ul>
</span>  

As you can see, it involved custom translations, and I don't like it...
I might remove that part of the code and just leave the link to the inbox... It does not bring a lot to the table anyways in terms of usability.

For the CP menu, here is what I've got, and it uses all stock MyBB translations.
(Although, I did this in a straight 4 hours zoned-in session, so it might have involved changing other css blocks, like {$modcplink} per example)

<span class="dropdown">
	<a class="white" data-toggle="dropdown" href="#"><img style="border-radius: 55%; transition:all 0.3s ease; margin-top: -2px;" src="{$mybb->user['avatar']}" onerror="this.onerror=null;this.src='{$mybb->settings['bburl']}/images/default-avatar.png';"  height="25px" align="middle" class="miniav"/></i></a>
		<ul class="dropdown-menu bullet pull-right notification animated fadeIn faster" role="menu" aria-labelledby="dLabel">	  
		{$usercplink}
		<li role="presentation"><a href="{$mybb->settings['bburl']}/usercp.php?action=profile"> &nbsp;&nbsp;&nbsp;{$lang->postbit_button_profile} </a></li>
		<li role="presentation"><a href="{$mybb->settings['bburl']}/usercp.php?action=editlists"> &nbsp;&nbsp;&nbsp;{$lang->welcome_open_buddy_list} </a></li>
		{$modcplink}
		{$admincplink}
		<hr style="width:90%; background-color:#dddddd">
		<li role="presentation"><a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}"> {$lang->welcome_logout} </a></li>
	</ul>
</span>

We will get there!

@melroy89
Copy link
Owner

melroy89 commented Dec 30, 2022

@Normand-Nadon Again, it's GPL licensed, could you share the latest changes with me so other people can benefit from this (once you think you are ready)?

See how to contact me on the left panel.

@Normand-Nadon
Copy link
Author

Sorry for the delay @Danger89
I had to put this project aside for some time, but I will return to it in February...
I will export my latest work, but it is still a work in progress.

I think I will simply remove the out-of-context links to the mailbox and call it a day fow now!

@Normand-Nadon
Copy link
Author

Normand-Nadon commented Feb 2, 2023

There, I merged my ideas with those from @sakis-tech and ended-up with this...
duente-theme.xml.zip

It is still a WIP, but I hope you like it too! :)

What was achieved:

  • Replaced all hardcoded text I could find with mybb $lang variables
  • Added the language switcher at the bottom and made sure it does not interfere with the theme switcher (makes it simpler to test the translations too!)
  • Removed the "User" pop-up menu and put it on the avatar instead
  • Removed some stuff in the Avatar/user menu and only kept what was in the right context
  • Made sure that the Avatar still shows when the user does not have one and the default is used instead (failsafe needed)
  • Changed translations on the guest header
  • Fixed some layout issues
  • Removed drop-down menu for the inbox as it is not meant to be seen in that context (auto-translations won't work)
  • Added the envelope that @sakis-tech posted earlier

@melroy89
Copy link
Owner

melroy89 commented Feb 2, 2023

Thanks! I will definitely take a look at this! And if this is validated, I will create a new release out of this, so everybody can benefit from the improvements.

@Normand-Nadon
Copy link
Author

Thanks! I will definitely take a look at this! And if this is validated, I will create a new release out of this, so everybody can benefit from the improvements.

So, did you have time to look at it? Is it worthy of making it to the main branch?

@melroy89
Copy link
Owner

melroy89 commented Feb 13, 2023

Yea, so you did additional changes as well 😢 . Like changing the background color from #f7f7f7 to #e7dfc6 as an example. I now need to go through all the CSS files to check if didn't change something unwanted.

Then, I need to do the same for the templates.

@melroy89
Copy link
Owner

I think we don't want to have the "Private Messages" text before the mail icon, I think that is redundant.

But we do want give back the options, which makes it much easier for new users to edit the profile/options/signature, etc.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants