Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
per-user interface language [Solved]
Page:  previous  1  2  3  next 
Avatar
Michaelsy #16
Member since Jun 2015 · 745 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 64351
Nice that you chose DokuWiki, that was certainly a good choice. (More or less small compromises have to be made everywhere.)
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Avatar
LarsDW223 #17
Member since Sep 2014 · 384 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
In reply to post ID 64351
@Robert:

I created a little change for the multilingual plugin which allows the admin to configure a UI language per user. It works like this:

If the logged in user has got a settings in ```user_settings``` then that language will be used. Otherwise normal processing continues (...check option ```use_browser_lang```).

Here is a example configuration for ```user_settings``` (it is a multi line text field):
```
UserA="de";
UserB="fr";
```
So in this example, if UserA logs in, the UI will be presented in german. If UserB logs in, the UI will be presented in french. If some different user logs in or if no one is logged in the plugin will act as before.

This solution has some pros and cons:
- only the admin can change the language UI for a user
- the config syntax is not as simple as clicking on a flag
+ it only needs to be set once. Each time the user logs in, the language is already set from the config

I created a pull-request for the multilingual plugin at github, see https://github.com/stonier/dokuwiki_plugins/pull/2.

Let me know what you think about this solution.
Avatar
Michaelsy #18
Member since Jun 2015 · 745 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Not bad!

Do you know where can one read which abbreviation is to be used for which language?
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Avatar
LarsDW223 #19
Member since Sep 2014 · 384 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Do you know where can one read which abbreviation is to be used for which language?

Searching the internet revealed an ISO standard:
ISO 639.2 "Codes for the Representation of Names of Languages"

DokuWiki seems to use it as there is a link to it on https://www.dokuwiki.org/localization.
Avatar
Michaelsy #20
Member since Jun 2015 · 745 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Quote by LarsDW223:
Searching the internet revealed an ISO standard:
ISO 639.2 "Codes for the Representation of Names of Languages"

Yes, the link mentioned by you, points to a page called "ISO 639.2". But that should probably refers to information about the ISO 639.1 code which is also listed there.

As far as I can see the ISO 639.1 code is relevant.

HTH - Michael Sy.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Avatar
Robert Cailliau #21
User title: Robert Cailliau
Member for 3 months · 12 posts · Location: Prévessin-Moëns, France
Group memberships: Members
Show profile · Link to this post
In reply to post #17
Oh! Well, great!

Yes, that will do for now.  Agreed that it's only the admin who can set it for now, but that can be helped later with a button in the user profile and building the multi-lingual plugin into the main code.

Sorry for being totally out of the game, I've never used github (stopped programming in 1993) but had a brief look.  Do I understand it well that there is a single php file to change?  That would be easy.
However, I still need to edit the file that has user_settings but I could not find that either.

No need to answer this, I can wait for an "official" update of the language plugin.

Very nice of all of you to help with this, have a good rest of the weekend (it' miserable, raining and dark here in France just North of Geneva airport).

Best!
Avatar
LarsDW223 #22
Member since Sep 2014 · 384 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
As the pull-request is not merged/accepted yet (I cannot guarantee that it will be accepted, we have to wait for the maintainer to react) I suggest you manually apply the changes in this way:

- Download the zip file from my GitHub repository with the changes from https://github.com/LarsGit223/dokuwiki_plugins.git
- Extract it
- The folder multilingual needs to be copied to your DokuWiki's Server plugin directory (That is the same as installing the plugin)
- After that there should be a new configuration option for the plugin multilingual which is called/labeled user_settings

In that the admin can list user specific settings as described earlier (so user_settings is not a file - it's the name of the new config setting that comes with my changes).
Avatar
Michaelsy #23
Member since Jun 2015 · 745 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Download the zip file from my GitHub repository with the changes from https://github.com/LarsGit223/dokuwiki_plugins.git

Sorry, I couldn't find a new zip file in your Repo (only those from the year 2014).
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Avatar
LarsDW223 #24
Member since Sep 2014 · 384 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Hmmm...where did you see that date?

Anyway if I download the zip file from that repository (URL https://github.com/LarsGit223/dokuwiki_plugins/archive/mas…) then it has the changes in it. The changes are in action.php and in the files in the conf folder (new array items user_settings).
Avatar
Michaelsy #25
Member since Jun 2015 · 745 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Quote by LarsDW223:
Hmmm...where did you see that date?
Here: https://github.com/LarsGit223/dokuwiki_plugins/releases/ta…
https://github.com/LarsGit223/dokuwiki_plugins/tree/master…

Quote by LarsDW223:
Anyway if I download the zip file from that repository (URL https://github.com/LarsGit223/dokuwiki_plugins/archive/mas…) then it has the changes in it.

I'm a bit confused. When I download your link I get a zip file that is 53 MB in size.

Edit: Sorry, now I understand. That is a zip file of the whole repository.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
This post was edited on 2019-01-13, 19:42 by Michaelsy.
Avatar
LarsDW223 #26
Member since Sep 2014 · 384 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
I'm a bit confused. When I download your link I get a zip file that is 53 MB in size.

Yes, because the original author has managed several different projects in one github repository and not like usual e.g. one plugin in one repository. And to place a pull-request there is nothing I can do except forking the whole repository.

But only the folder multilingual is relevant for the multilingual plugin. Usually that would be it's own repository. I do not know why the original author has choosen such a structure. It has many disadvantages (e.g. you cannot use the zip file URL from github as the downloadurl on the DokuWiki plugin page).

Edit: that's not the normal way to do it - just have a look at most other plugin's repositories.
This post was edited on 2019-01-13, 19:46 by LarsDW223.
Avatar
Robert Cailliau #27
User title: Robert Cailliau
Member for 3 months · 12 posts · Location: Prévessin-Moëns, France
Group memberships: Members
Show profile · Link to this post
LarsDW223:
I tried that: got the 58MB zip, extracted, found dokuwiki_plugins-master -> releases -> multilingual-1.0.1.tar.gz
extracted again, got a folder multilingual, replaced the existing one in lib ->plugins with the new one.

Then found the new settings, but it did not work until I realised that a semicolon was missing at the very end…
Each line needs a semicolon, fortunately I have done enough php to know that what you are doing is executing those settings as code and the missing semicolon made php fail(*).

Is executing that as code a security risk? Probably, but I don't mind because the whole thing will be in an access protected area in the first place, and I would be the only administrator.

It now does work, thanks for all the help!


(*) I could go on for hours about the miserable state of programming languages today and when and why we failed in that that area with www.  But not here and not now.
Avatar
LarsDW223 #28
Member since Sep 2014 · 384 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Each line needs a semicolon, fortunately I have done enough php to know that what you are doing is executing those settings as code and the missing semicolon made php fail(*).

Please don't worry, it is not executed as code. But it is not possible (or I don't know how to do it) to create an unlimited set of key value pairs in the DokuWiki config UI. So I decided to use a text field and parse it's contents. So I had to choose a format. I decided to choose username="language";. You can have but don't need a linebreak between subsequent entries.

So both this examples should work:

Example A:
UserA="de";
UserB="fr";

Example B:
UserA="de";UserB="fr";

The bottom line is: it's no code that is executed, no security risk. The ; just serves as a separator.

P.S.: I am open for suggestions if someone has an idea for a better format. It just needs to be easily parseable via a regular expression.
Avatar
Robert Cailliau #29
User title: Robert Cailliau
Member for 3 months · 12 posts · Location: Prévessin-Moëns, France
Group memberships: Members
Show profile · Link to this post
OK, so I don't understand how you did it, but never mind:  it works, and it does the job for now.
So many thanks again, and good night.
Avatar
Michaelsy #30
Member since Jun 2015 · 745 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Please could you put [Solved] in the title? (by editing your first post)
One more please: Let us(me) know in case you publish a website on the DokuWiki basis, with general read access.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  previous  1  2  3  next 
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-03-23, 18:08:42 (UTC +01:00)