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

Add a static "setRTLTextPlugin" method #206

Closed
gowin20 opened this issue Oct 19, 2023 · 5 comments
Closed

Add a static "setRTLTextPlugin" method #206

gowin20 opened this issue Oct 19, 2023 · 5 comments

Comments

@gowin20
Copy link
Contributor

gowin20 commented Oct 19, 2023

Describe the problem

As outlined in #204, right-to-left languages such as Arabic currently display backwards in Esri Leaflet Vector. Since this plugin depends on maplibre, the fix is to call maplibregl.setRTLTextPlugin(); a top-level static maplibre method. This is not currently possible for Esri Leaflet Vector users to do, so we need to expose this setRTLTextPlugin method.

Describe the proposed solution

I would like to add a top-level static method called setRTLTextPlugin to this library that simply calls the equivalent maplibre method. This would mirror the functionality of maplibre and would make it easier for users to understand why they need to pass a Mapbox plugin to their Leaflet library to display a map in Arabic.

Alternatives considered

An alternative is to make the setRTLTextPlugin method a member of VectorBasemapLayer, but I believe making it a top-level static method is the best choice as that most closely mirrors maplibre.

Additional Information

No response

gowin20 added a commit that referenced this issue Oct 19, 2023
gavinr-maps added a commit that referenced this issue Oct 20, 2023
@gavinr-maps
Copy link
Contributor

Resolved in #207. Thanks @gowin20!

@OwaisNadeemCentric
Copy link

OwaisNadeemCentric commented Oct 23, 2023

Resolved in #207. Thanks @gowin20!

This Library module still doesn't use setRTLTextPlugin

declare module 'esri-leaflet-vector' {
export function vectorBasemapLayer (key: any, options: any): any;
export var VectorBasemapLayer: any;
export function vectorTileLayer (key: any, options: any): any;
export var VectorTileLayer: any;
export function maplibreGLJSLayer (options: any): any;
export var MaplibreGLJSLayer: any;
}

I am using esri-leaflet-vector latest version.

@gavinr-maps
Copy link
Contributor

@OwaisNadeemCentric
Copy link

OwaisNadeemCentric commented Oct 24, 2023

Hi @OwaisNadeemCentric please try with the newly-released v4.2.2: https://github.com/Esri/esri-leaflet-vector/releases/tag/v4.2.2

Example is here: https://github.com/Esri/esri-leaflet-vector/blob/master/examples/rtl-language.html

Hi @gavinr-maps
Now in latest version v4.2.2 the RTLTextPlugin is working but there is still one more problem.

we need this method as well getRTLTextPluginStatus() to check the status of the plugin if it is already loaded or not otherwise you will get the following error if we call RTLTextPlugin multiple times.

ERROR Error: setRTLTextPlugin cannot be called multiple times.

@OwaisNadeemCentric
Copy link

Hi @OwaisNadeemCentric please try with the newly-released v4.2.2: https://github.com/Esri/esri-leaflet-vector/releases/tag/v4.2.2
Example is here: https://github.com/Esri/esri-leaflet-vector/blob/master/examples/rtl-language.html

Hi @gavinr-maps Now in latest version v4.2.2 the RTLTextPlugin is working but there is still one more problem.

we need this method as well getRTLTextPluginStatus() to check the status of the plugin if it is already loaded or not otherwise you will get the following error if we call RTLTextPlugin multiple times.

ERROR Error: setRTLTextPlugin cannot be called multiple times.

A potential solution for this error is to ensure that you call the getRTLTextPlugin function only at the application's root level. Otherwise, you may encounter an error.

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

3 participants