From 0a1d96ea22cbd46fa1a9b02ad36a4ca77d4fdaee Mon Sep 17 00:00:00 2001 From: Joost De Cock Date: Mon, 27 Aug 2018 16:45:03 +0200 Subject: [PATCH] :sparkles: Added support for xml:lang attribute in SVG tag --- src/pattern.js | 7 +++--- src/svg.js | 1 + tests/fixtures/render.js | 53 +++++++++++++++++++++++++++++++--------- tests/pattern.test.js | 2 +- tests/svg.test.js | 6 +++++ 5 files changed, 53 insertions(+), 16 deletions(-) diff --git a/src/pattern.js b/src/pattern.js index 9337ccf31fd..540e82e7701 100644 --- a/src/pattern.js +++ b/src/pattern.js @@ -22,7 +22,9 @@ export default function Pattern(config = false) { // Data containers this.settings = { mode: "draft", - idPrefix: "fs-" + idPrefix: "fs-", + locale: "en", + units: "metric" }; this.options = {}; this.store = new Store(); @@ -31,8 +33,7 @@ export default function Pattern(config = false) { // Merge config with defaults let defaults = { measurements: {}, - options: {}, - units: "metric" + options: {} }; this.config = { ...defaults, ...config }; for (let i in config.options) { diff --git a/src/svg.js b/src/svg.js index 36f8c61dc05..7462b0b0c1a 100644 --- a/src/svg.js +++ b/src/svg.js @@ -18,6 +18,7 @@ function Svg(pattern) { this.attributes.add("xmlns", "http://www.w3.org/2000/svg"); this.attributes.add("xmlns:svg", "http://www.w3.org/2000/svg"); this.attributes.add("xmlns:xlink", "http://www.w3.org/1999/xlink"); + this.attributes.add("xml:lang", pattern.settings.locale); this.attributes.add( "xmlns:freesewing", "http://freesewing.org/namespaces/freesewing" diff --git a/tests/fixtures/render.js b/tests/fixtures/render.js index 7db4f8960ed..4155c019e45 100644 --- a/tests/fixtures/render.js +++ b/tests/fixtures/render.js @@ -6,7 +6,36 @@ var render = { + + + + + + + + + + + + + +`, + boilerplateNl: ` + +