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

[Feature request] [direct mode] delete translated pages when original page is edited, so direct translations are always up-to-date #9

Open
Chris75forumname opened this issue Jun 15, 2023 · 0 comments

Comments

@Chris75forumname
Copy link

Chris75forumname commented Jun 15, 2023

It would be great to have the option to get translation pages deleted when original pages are edited and saved. So whenever the translated page is visited thereafter, the direct mode is triggered to translate the page again (because it was edited) to asure translations are always up-to-date.

I did a hack myself. Since I did not know, how to integrate this properly into your plugin's code, I did the obvious and hacked the exact spot, where pages are saved in the DokuWiki core's source code. I know, this is terrible practice, but I do not know better. (For I am a programming novice.) So here comes the code, only for you to see, how this is a straight forward approach. I added this code at the end of the function saveWikiText( ) in /dokuwiki/inc/common.php after the useheading handler:

$id_transl = 'en:' . $id;
if ( page_exists($id_transl) ) {                      // checks if translated page exists
    sleep(1);                                         // hold for 1 sec before recursive page save
    saveWikiText($id_transl, '', 'Success Message');  // deletes translated page
}

And for me this works like a charm! Maybe you could integrate this (as a full blown function) in your magnificent plugin. 😀

@Chris75forumname Chris75forumname changed the title [direct mode] delete translated pages when original page is edited, so direct translations are always up-to-date [Feature request] [direct mode] delete translated pages when original page is edited, so direct translations are always up-to-date Jun 15, 2023
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

1 participant