Discussion:
[mapguide-users] Redline + Language
torrini
2018-01-08 14:07:28 UTC
Permalink
I upgraded our MapGuide to version 3.1
Now I'm adapting the Redline widget which we use for dimensioning. I already
could edit the concerning files to label the lines with their lengths.
Unfortunatly I now have to struggle with the language: our used language is
german. The de- and de.json-file exist. When starting the widget everything
works well. In markupmain.php I edited the line
/markupForm.action = "editmarkup.php";/
to
/markupForm.action = "editmarkup.php?LOCALE="+"<?= $locale ?>";/
So that the edit-page will appear in german as well. When digitizing and
finishing a line the edit-page reloads in english.

<Loading Image...>
<Loading Image...>

*How can I prevent that behavior?*




--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-01-08 15:54:40 UTC
Permalink
You need to make sure editmarkup.php also roundtrips LOCALE back to
markupmain.php

Here:
https://trac.osgeo.org/fusion/browser/trunk/widgets/Redline/editmarkup.php#L388

Also I think this is a bug overall, the widget should already have been
localizable. All that really had to be done on your end was provide
translated strings in de and de.json

I'd be interested in your code changes after this to make the changes in the
actual redline widget.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
torrini
2018-01-09 09:46:41 UTC
Permalink
My edits:


*markupmain.php*
[...]
function SubmitCommand(cmd)
{
var commandInput = document.getElementById("commandInput");
commandInput.value = cmd;

if (cmd == CMD_EDIT) {
*markupForm.action = "editmarkup.php?LOCALE="+"<?= $locale ?>";*
} else if (cmd == CMD_UPLOAD) {
markupForm.action = "uploadmarkup.php";
} else if (cmd == CMD_EDITSTYLE) {
markupForm.action = "editmarkupstyle.php";
}
else {
markupForm.action = "markupmain.php";
}
markupForm.submit();
}
[...]

*editmarkup.php*
[...]
function CloseEditor()
{
ClearDigitization(true);
var map = Fusion.getMapByName(mapName).mapWidget;
map.message.clear();

var editForm = document.getElementById("editForm");
*editForm.action = "markupmain.php?"+"<?= $locale ?>";*

editForm.submit();
}
[...]
<body onLoad="OnLoad()" onUnload="OnUnload()" marginwidth=5 marginheight=5
leftmargin=5 topmargin=5 bottommargin=5 rightmargin=5>
<form action=&quot;editmarkup.php?locale=&lt;?= $locale ?>" method="post"
enctype="application/x-www-form-urlencoded" id="editForm" target="_self">

[...]


Still the widget switches back to english :-/
The function CloseEditor() won't be used till the user closes the dialog.
But the language already changes when one line is made. So the functions
AddLine() and SubmitCommand(cmd) are used. That's why I edited the form in
the html-part (action="editmarkup.php?locale=<?= $locale ?>").



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Loading...