Note that there are some explanatory texts on larger screens.

plurals
  1. POInternationalization for user defined input
    primarykey
    data
    text
    <p>I'm trying to build a <code>localization</code> for user defined input. Example: a user could define categories like soccer but in several languages.</p> <p>The model entity could have a filed something like this: </p> <pre class="lang-cs prettyprint-override"><code> @ManyToMany @MapKeyColumn(name = "locale", insertable = false, updatable = false) public Map&lt;String, L18n&gt; titles; </code></pre> <p>I'd like to store the localized strings like this:</p> <pre class="lang-cs prettyprint-override"><code>@Entity public class L18n { @Id @Constraints.Required @Formats.NonEmpty public Integer id; public String key; public String locale; @Column(columnDefinition = "TEXT") public String text; } </code></pre> <p>We use <strong>yaml</strong> to store the testdata:</p> <pre class="lang-cs prettyprint-override"><code> category: - !!models.Category ... titles: - !!models.L18n key: soccer l18n: - !!models.L18n key: soccer locale: de-CH text: fdfdfsee - !!models.L18n key: soccer locale: fr-CH text: dlfkjsdlfj </code></pre> <p>With this solution I'm getting this error:</p> <pre class="lang-cs prettyprint-override"><code> [error] Caused by: org.yaml.snakeyaml.error.YAMLException: No suitable constructor with 1 arguments found for interface java.util.Map [error] at org.yaml.snakeyaml.constructor.Constructor$ConstructSequence.construct(Constructor.java:574) [error] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [error] at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:296) [error] ... 65 more </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload