Web based family history software

Question Error in the order that custom module functions are called

  • sevtor
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 weeks 7 hours ago #1 by sevtor
When adding new custom modules the module structure includes a file module.php which can contain different functions.
For report modules it is important to include translation files for supported languages. The translations are included by the definition of a function customTranslations($lang) which shall return an array of translations.

However, these translations are activated when the report is generated (good, expected) but not when the report was selected. The effect can be seen in the included image Rapporter-orig.png. My proposed solution is to add translations from custom modules already in the file app/Module/ModuleCustomTrait.php as can be seen in the included patch file. After this change clicking on the Reports menu item will yield a menu with translated options.

(This patch is also included in PR#4945)

webtrees 2.1.18, php 8.1.27, torstendahl.se/demo/
Attachments:

Please Log in or Create an account to join the conversation.

More
3 weeks 7 hours ago #2 by Franz Frese
I do not think so. When language is changed, also the menu texts are changed.



Please Log in or Create an account to join the conversation.

  • sevtor
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 weeks 6 hours ago #3 by sevtor

I do not think so. When language is changed, also the menu texts are changed.
 
This is because you only have standard report modules that are installed in webtrees/resources/xml/reports.
But I have own report modules installed under module_v4/ and that is when the error occurs as you can see on my images!

webtrees 2.1.18, php 8.1.27, torstendahl.se/demo/

Please Log in or Create an account to join the conversation.

More
3 weeks 6 hours ago #4 by Franz Frese
may be it is related to the discussion at  github.com/fisharebest/webtrees/issues/3783 .
Seems as if you have to insert your own menu at this time, like vesta does (for example at  www.onsverleden.eu/webtrees/tree/bijlholt# (more charts)

Please Log in or Create an account to join the conversation.

More
3 weeks 4 hours ago - 2 weeks 6 days ago #5 by Franz Frese
Perhaps Greg can tell the best way, how to do?
I did a close look at your changes and I think there is no need to change the default ModuleCustomTrait.php .
If you use your code of 
    public function customTranslations(string $language): array
in your custom modules the translation of the webtrees menu is also done correct and in time.
I did a little test within a module of me. I changed the menu text  'Changes' occuring within the repports submenu by the german 'Änderungen'. See the result:

 
 
Last edit: 2 weeks 6 days ago by Franz Frese.

Please Log in or Create an account to join the conversation.

More
2 weeks 6 days ago #6 by Jefferson49
Has this issue already been solved? If I load the latest code from github.com/sevtor/modules , all the report menu entries are translated correctly.

Please Log in or Create an account to join the conversation.

More
2 weeks 6 days ago - 2 weeks 6 days ago #7 by Franz Frese

Has this issue already been solved? If I load the latest code from github.com/sevtor/modules , all the report menu entries are translated correctly.
It is not a matter of correct translation. My concern is flawless integration into webtrees. The less code Greg has to check, the more likely is the integration.
I see Sevtor has already changed code. A change of the app/Module/ModuleCustomTrait.php is no longer necessary. The file can be removed from the pullrequest #4945. 
Last edit: 2 weeks 6 days ago by Franz Frese.

Please Log in or Create an account to join the conversation.

  • sevtor
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 weeks 5 days ago #8 by sevtor
I am really embarrassed about this matter!
In my test environment I used symbolic links for some files and because of that the reported effect occurred. When I changed to use real files there are no problems.

I will remove the file ModuleCustomTrait.php  from PR #4945 !!

webtrees 2.1.18, php 8.1.27, torstendahl.se/demo/

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
}