<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Json on widerin</title><link>http://widerin.net/tags/json/</link><description>Recent content in Json on widerin</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 26 Jul 2020 12:30:34 +0200</lastBuildDate><atom:link href="http://widerin.net/tags/json/index.xml" rel="self" type="application/rss+xml"/><item><title>Weblate and i18next json files</title><link>http://widerin.net/posts/2016/weblate-and-i18next-json-files/</link><pubDate>Fri, 29 Apr 2016 00:00:00 +0000</pubDate><guid>http://widerin.net/posts/2016/weblate-and-i18next-json-files/</guid><description>&lt;p&gt;There&amp;rsquo;s a &lt;a href="https://github.com/nijel/weblate/issues/775"&gt;bug report on github&lt;/a&gt; about JSON format breaks &lt;a href="http://i18next.com/"&gt;i18next&lt;/a&gt; files due to automatic restructuring. Actually it flattens your &lt;a href="http://i18next.com/"&gt;i18next&lt;/a&gt; JSON file and makes it unusable for further usage.&lt;/p&gt;
&lt;p&gt;So after starting with a JSON file like:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;navbar&amp;#34;: {
&amp;#34;reward&amp;#34;: &amp;#34;Rewards&amp;#34;,
&amp;#34;about&amp;#34;: &amp;#34;About&amp;#34;
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;you end up with a committed file which was transformed into this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;navbar.reward&amp;#34;: &amp;#34;Rewards&amp;#34;,
&amp;#34;navbar.about&amp;#34;: &amp;#34;About&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="use-weblate-pre_commit_scripts"&gt;Use Weblate PRE_COMMIT_SCRIPTS&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://weblate.org"&gt;Weblate&lt;/a&gt; offers script hooks before or after a repository action happens. I&amp;rsquo;m using &lt;a href="https://docs.weblate.org/en/latest/admin/config.html#std:setting-PRE_COMMIT_SCRIPTS"&gt;one of those hooks&lt;/a&gt; to execute a short &lt;a href="http://www.python.org"&gt;Python&lt;/a&gt; script which reformats JSON again to be usable in &lt;a href="http://i18next.com/"&gt;i18next&lt;/a&gt; translation tools again. The script below is &lt;a href="https://gist.github.com/saily/f8a9f72c6b064d51f09040d66e981240"&gt;also available on Github&lt;/a&gt;:&lt;/p&gt;</description></item></channel></rss>