diff --git a/bundles/org.eclipse.epsilon.emc.rdf.dt/src/org/eclipse/epsilon/emc/rdf/dt/RDFModelConfigurationDialog.java b/bundles/org.eclipse.epsilon.emc.rdf.dt/src/org/eclipse/epsilon/emc/rdf/dt/RDFModelConfigurationDialog.java index a821e99..df48e28 100644 --- a/bundles/org.eclipse.epsilon.emc.rdf.dt/src/org/eclipse/epsilon/emc/rdf/dt/RDFModelConfigurationDialog.java +++ b/bundles/org.eclipse.epsilon.emc.rdf.dt/src/org/eclipse/epsilon/emc/rdf/dt/RDFModelConfigurationDialog.java @@ -394,8 +394,8 @@ public void verifyText(VerifyEvent event) { if (text.length() > 0) { StringJoiner invalidTags = new StringJoiner(" "); invalidTags.add("\nInvalid tags: "); - for (String tag : text.split(",")) { - if (!bcp47Validator(tag)) { + for (String tag : text.split(",")) { + if (!RDFModel.isValidLanguageTag(tag)) { invalidTags.add(tag); } } @@ -412,11 +412,6 @@ public void verifyText(VerifyEvent event) { return groupContent; } - public boolean bcp47Validator (String bcp47tag) { - boolean isValidBCP47 = !("und".equals(Locale.forLanguageTag(bcp47tag).toLanguageTag())); - return isValidBCP47; - } - @Override protected void loadProperties(){ super.loadProperties(); diff --git a/bundles/org.eclipse.epsilon.emc.rdf/src/org/eclipse/epsilon/emc/rdf/RDFModel.java b/bundles/org.eclipse.epsilon.emc.rdf/src/org/eclipse/epsilon/emc/rdf/RDFModel.java index 4a771b3..1b62e64 100644 --- a/bundles/org.eclipse.epsilon.emc.rdf/src/org/eclipse/epsilon/emc/rdf/RDFModel.java +++ b/bundles/org.eclipse.epsilon.emc.rdf/src/org/eclipse/epsilon/emc/rdf/RDFModel.java @@ -352,7 +352,8 @@ public String getPrefix(String namespaceURI) { return model.getNsURIPrefix(namespaceURI); } - public boolean isValidLanguageTag (String bcp47tag) { + // Using Java's Locale class to check that tags conform to bcp47 structure + public static boolean isValidLanguageTag (String bcp47tag) { boolean isValidBCP47 = !("und".equals(Locale.forLanguageTag(bcp47tag).toLanguageTag())); return isValidBCP47; }