Fusion: How do I define taskPaneTitle, legendTitle, etc?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Fusion: How do I define taskPaneTitle, legendTitle, etc?

David Wilhelmsson
Hi,

I have a multilingual website that dynamically (ASP.net) translates each web page according to a language selected. I currently use MaestroAPI SDK 4.0.1 to copy my MapGuide 2.2 application definition to a session and rewrite items such as labels, tooltips, legend labels and so forth before displaying it. This works well, however there are some aspects of Fusion I would like to translate which I don't how to programmatically access including:

* taskPaneTitle
* legendTitle
* ovmapTitle
* selectionPanelTitle

I also use the Measure widget and would like to be able to programmatically translate the text displayed by this widget on the task pane.

Can someone point me in the right direction?

Kind regards,
Dave.
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

Jackie Ng
You need to provide a translation for the following string bundles:

fusion/text/[your language code].json
fusion/text/[your language code]
fusion/lib/OpenLayers/Lang/[your language code].js

Passing in locale=[your language code] as part of the fusion URL will instruct it to use these string bundles.

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

David Wilhelmsson
Hi Jackie,

Thanks for the speedy reply and it's exactly what I was looking for.

ps. Thanks for all your work with MapGuide!

Kind regards,
Dave.
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

David Wilhelmsson
Hi,

Unfortunately, I'm not having any success creating my own language strings. Here's what I've done:

1. Copy fusion/text/en.json -> fusion/text/[language code].json
2. Edited fusion/text/[language code].json line 1 -> Fusion.Strings.[language code] = {
3. Translated the rest of fusion/text/[language code].json

4. Copy fusion/text/en -> fusion/text/[language code]
5. Translated fusion/text/[language code]

6. Copy fusion/lib/OpenLayers/Lang/en.js -> fusion/lib/OpenLayers/Lang/[language code].js
7. Edited fusion/lib/OpenLayers/Lang/[language code].js line 15 -> OpenLayers.Lang.[language code] = {
8. Translate the rest of fusion/lib/OpenLayers/Lang/[language code].js

9. Restarted the MapGuide Server service (just in case)

10. Visited [fusion url]&locale=fr to test the partial french translation with MapGuide 2.2 -> works
11. Visited [fusion url]&locale=[language code] -> falls back to English and does not include the translated strings bundles

As a test, I copied fusion/text/fr.json and fusion/text/fr from my MapGuide 2.2 installation to MapGuide 2.4 RC2 and visited [fusion url]&locale=fr in my MapGuide 2.4 RC2 installation and that also fell back to English and did not display the partial French translation.

It feels like I'm missing a step to register the new [language code] with fusion so that it knows that [language code] exists. Can anyone point me in the right direction?

Kind regards,
Dave.
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

zspitzer
the fusion localisation only kicks if the OL localisation works

On Wed, Sep 26, 2012 at 4:56 PM, David Wilhelmsson
<[hidden email]> wrote:

> Hi,
>
> Unfortunately, I'm not having any success creating my own language strings.
> Here's what I've done:
>
> 1. Copy fusion/text/en.json -> fusion/text/[language code].json
> 2. Edited fusion/text/[language code].json line 1 ->
> Fusion.Strings.[language code] = {
> 3. Translated the rest of fusion/text/[language code].json
>
> 4. Copy fusion/text/en -> fusion/text/[language code]
> 5. Translated fusion/text/[language code]
>
> 6. Copy fusion/lib/OpenLayers/Lang/en.js ->
> fusion/lib/OpenLayers/Lang/[language code].js
> 7. Edited fusion/lib/OpenLayers/Lang/[language code].js line 15 ->
> OpenLayers.Lang.[language code] = {
> 8. Translate the rest of fusion/lib/OpenLayers/Lang/[language code].js
>
> 9. Restarted the MapGuide Server service (just in case)
>
> 10. Visited [fusion url]&locale=fr to test the partial french translation
> with MapGuide 2.2 -> works
> 11. Visited [fusion url]&locale=[language code] -> falls back to English and
> does not include the translated strings bundles
>
> As a test, I copied fusion/text/fr.json and fusion/text/fr from my MapGuide
> 2.2 installation to MapGuide 2.4 RC2 and visited [fusion url]&locale=fr in
> my MapGuide 2.4 RC2 installation and that also fell back to English and did
> not display the partial French translation.
>
> It feels like I'm missing a step to register the new [language code] with
> fusion so that it knows that [language code] exists. Can anyone point me in
> the right direction?
>
> Kind regards,
> Dave.
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Fusion-How-do-I-define-taskPaneTitle-legendTitle-etc-tp5004258p5004494.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-users



--
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
+61 405 847 168
_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

Jackie Ng
In reply to this post by David Wilhelmsson
It's the web tier and not the server tier that probably requires restarting.

Another test is in a javascript console after the Fusion layout has loaded, test if Fusion.Strings.[language code], OpenLayers.Lang.[language code] are undefined. If either one is undefined, the string bundle is probably 404'ing, so it falls back to english.

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

David Wilhelmsson
This post was updated on .
Hi,

After a little more investigation, I noticed that fusion/text/*.json and lib/OpenLayers/Lang/*.js were being compressed in lib/fusionSF-compressed.js. I manually added my new fusion/text/[language code].json and fusion/lib/OpenLayers/Lang/[language code].js to fusion/templates/mapguide/[theme name]/index.html and everything worked. I guess I could have also built my own fusionSF-compressed.js if I knew how to.

In summary, here's what I did to get my own language string:

1. Copy fusion/text/en.json -> fusion/text/[language code].json
2. Edited fusion/text/[language code].json line 1 -> Fusion.Strings.[language code] = {
3. Translated the rest of fusion/text/[language code].json

4. Copy fusion/text/en -> fusion/text/[language code]
5. Translated fusion/text/[language code]

6. Copy fusion/lib/OpenLayers/Lang/en.js -> fusion/lib/OpenLayers/Lang/[language code].js
7. Edited fusion/lib/OpenLayers/Lang/[language code].js line 15 -> OpenLayers.Lang.[language code] = {
8. Translate the rest of fusion/lib/OpenLayers/Lang/[language code].js

(please note restarting the MapGuide Server service is not required for the final solution)

9. Edited fusion/templates/mapguide/[theme name]/index.html and inserted the following lines after the import of fusionSF-compressed.js (repeat for each theme in use):

        <script type="text/javascript" src="../../../text/[language code].json"></script>        <script type="text/javascript" src="../../../lib/OpenLayers/Lang/[language code].js"></script>
- or -

9. Rebuild fusionSF-compressed.js to include fusion/text/[language code].json and fusion/lib/OpenLayers/Lang/[language code].js

10. Visit [fusion url]&locale=[language code] (please note I found that "locale" is case sensitive in MapGuide 2.2) for your translated interface.

I'm not sure if I need to do anything further with fusion/text/[language code], however the above steps work for me.

Hope this helps anyone else out!

Kind regards,
Dave.
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

David Wilhelmsson
This post was updated on .
Hi,

After following the above steps, here's some items that I've found that aren't being translated:

1. The BasemapSwitcher widget is reading the 'noCommercialMapLayers' string from fusion/text/[language code].json, however the strings for the commercial map layers are not coming from any language string bundle. For example, en.json defines 'bingStreet':'Bing Street', however the widget displays 'Bing Maps Street', therefore the translation is not coming from en.json. I've tested this with both MapGuide 2.2 and MapGuide 2.4 RC2.

2. The Measure widget has strings that seem to be defined in fusion/text/[language code], however these language strings don't seem to be used by the widget. I presume this has to do with I don't know what do with fusion/text/[language code].

Any ideas?

Kind regards,
Dave.
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

David Wilhelmsson
Hi,

Having another look at the translations today, I've found the fusion/text/[language code] are now being correctly read, therefore the Measure widget is being translated correctly. My guess was that these values were being cached by MapGuide or IIS (I cleared the cache in the web browser, so it was clean on the client side).

I still found the BasemapSwitcher widget is not translating strings from fusion/text/[language code].json (excluding 'noCommercialMapLayers').

Kind regards,
Dave.
Reply | Threaded
Open this post in threaded view
|

Re: Fusion: How do I define taskPaneTitle, legendTitle, etc?

David Wilhelmsson
Hi,

I found the following post:

http://osgeo-org.1560.n6.nabble.com/Localized-Search-Quick-Plot-and-Print-widgets-td4183118.html

which points to fusion/text/[language code] being cached by the PHP server. I'm using IIS, so I've recycled the application pool to get the localization strings to be re-read.

Kind regards,
Dave.