Skip to content

Commit

Permalink
4 - Lang working
Browse files Browse the repository at this point in the history
  • Loading branch information
morehawes committed Feb 16, 2024
1 parent c62a002 commit 49e0b6e
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 2,310 deletions.
87 changes: 87 additions & 0 deletions docs/content/5.customise.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,93 @@ Be sure to check out the full list of:

- **[Editor Options](editor#options)** – to customise the Editor Mode, including the GeoJSON output and confirmation messages.

### Localization

All text displayed by Waymark JS is fully customisable and can be translated/localised into any language.

You can modify the default strings using the `config.language` option when initialising the Map. In the example above, all text displayed by the Editor user interface will be in French.

```javascript
// Add translations for the Editor
config.language = {
action_fullscreen_activate: "Plein écran",
action_fullscreen_deactivate: "Sortir du plein écran",
action_locate_activate: "Montre-moi où je suis",

// Etc..

show_direction: "Montrer la direction",
reverse_direction: "Inverser la direction",
sleep_wake_message: "Cliquez ou survolez pour réveiller",
};

// Initialise with our options
editor.init(config);
```

The full list of localisation strings is:

```javascript
const english = {
// Common (Viewer & Editor)
action_fullscreen_activate: "View Fullscreen",
action_fullscreen_deactivate: "Exit Fullscreen",
action_locate_activate: "Show me where I am",
action_zoom_in: "Zoom in",
action_zoom_out: "Zoom out",
label_total_length: "Total Length: ",
label_max_elevation: "Max. Elevation: ",
label_min_elevation: "Min. Elevation: ",
label_ascent: "Total Ascent: ",
label_descent: "Total Descent: ",

// Editor only
add_line_title: "Draw a Line",
add_photo_title: "Upload an Image",
add_marker_title: "Place a Marker",
add_rectangle_title: "Draw a Rectangle",
add_polygon_title: "Draw a Polygon",
add_circle_title: "Draw a Circle",
upload_file_title:
"Read Lines and Markers from file (GPX/KML/GeoJSON supported, which most apps should Export to)",
action_duplicate: "Duplicate",
action_delete: "Delete",
action_edit: "Edit",
action_edit_done: "Finish editing",
action_upload_image: "Upload Image",
object_title_placeholder: "Title",
object_image_placeholder: "Image URL",
object_description_placeholder: "Description",
object_type_label: "Type",
marker_latlng_label: "Lat,Lng",
action_delete_confirm: "Are you sure you want to delete this",
action_search_placeholder: "Search...",
object_label_marker: "Marker",
object_label_line: "Line",
object_label_shape: "Shape",
object_label_marker_plural: "Markers",
object_label_line_plural: "Lines",
object_label_shape_plural: "Shapes",
error_message_prefix: "Waymark Error",
info_message_prefix: "Waymark Info",
debug_message_prefix: "Waymark Debug",
error_file_type: "This file type is not supported.",
error_file_conversion: "Could not convert this file to GeoJSON.",
error_file_upload: "File upload error.",
error_photo_meta: "Could not retrieve Image metadata.",
info_exif_yes: "Image location metadata (EXIF) detected!",
info_exif_no: "Image location metadata (EXIF) NOT detected.",
error_no_wpmedia: "WordPress Media Library not found",
no_direction: "No Direction",
show_direction: "Show Direction",
reverse_direction: "Reverse Direction",
sleep_wake_message: "Click or Hover to Wake",
};
```

> [!TIP]
> If a translation is not provided, the default English string will be used.
## Styling

Most elements can be styled using CSS and have sensibly named `waymark-` classes.
Expand Down
64 changes: 0 additions & 64 deletions docs/public/examples/editor-pub.html

This file was deleted.

99 changes: 0 additions & 99 deletions docs/public/examples/editor-route.html

This file was deleted.

Loading

0 comments on commit 49e0b6e

Please sign in to comment.