json-locale

Unicode Consortium JSON locale files.

npm install json-locale
12 downloads in the last week
48 downloads in the last month
<h1>json-locale</h1>
<p><strong>(c)<a href="http://www.bumblehead.com" title="bumblehead">Bumblehead</a>, 2013</strong> <a href="#license">MIT-license</a>, <a href="#terms">Unicode Terms</a></p>
<h3>OVERVIEW:</h3>
<p>The <a href="http://www.unicode.org/repos/cldr-aux/json/22.1/" title="unicode JSON">official Unicode ldml-JSON</a> files are provided here. These files provide <strong>standardised</strong> format descriptors for display of times, dates, currencies, etc., using the <a href="http://cldr.unicode.org/index/cldr-spec/json" title="ldml-to-json spec">Unicode standard</a>. Additional scripts included help you generate new collections of JSON files that contain needed data only.</p>
<p>The benefits of libraries that follow the Unicode Standard for number and date formatting:<br> <em> compatible with other systems that follow the standard
 </em> usable with international (locale-specific) content</p>
<p>The original JSON files include formatting rules for multiple types of calendar and other information you probably do not need. Use this script to generate your own collection of these files that contain only the information you need.</p>
<hr>
<h4><a id="install"></a>INSTALL:</h4>
<p>json-local may be downloaded directly or installed through <code>npm</code>.</p>
<ul>
<li><p><strong>npm</strong>   </p>
<pre><code class="lang-bash">$ npm install json-locale</code></pre>
</li>
<li><p><strong>Direct Download</strong></p>
<pre><code class="lang-bash">$ git clone https://github.com/iambumblehead/json-locale.git</code></pre>
</li>
</ul>
<hr>
<h4><a id="get-started">Get Started:</h4>
<ol>
<li><p><strong>Before Starting...</strong>   </p>
<p>&#39;Examples demonstrate usage from a shell but this script is also usable from a javascript file. Each environment uses the same modifiers. Only the syntax is different. &#39;Both examples would produce the same output.</p>
<blockquote>
<p><em>shell</em></p>
<pre><code class="lang-bash">$ node ./json-locale.js \  
 --inputPath=./JSONlocale/main \
 --keep=numbers,currencies,languages \
 --keepCalendars=gregorian \
 --keepCalendarItems=months,days,dateFormats,timeFormats \
 --keepNumberItems=symbolsFormatsNumberSystemLatn,currencies</code></pre>
<p><em>javascript file</em></p>
<pre><code class="lang-javascript">var jsonLocale = require(&#39;json-locale&#39;);
jsonLocale.build({  
 inputPath : &#39;./JSONlocale/main&#39;,
 keep : [&quot;numbers&quot;, &quot;currencies&quot;, &quot;languages&quot;],  
 keepCalendars : [&quot;gregorian&quot;],
 keepCalendarItems : [
   &quot;months&quot;,
   &quot;days&quot;,
   &quot;dateFormats&quot;,
   &quot;timeFormats&quot;
 ],
 keepNumberItems : [
   &quot;symbolsFormatsNumberSystemLatn&quot;, 
   &quot;currencies&quot;
 ],
}, function (err, res) {
 if (err) return console.log(err);
 console.log(&#39;finished!&#39;)
});</code></pre>
</blockquote>
</li>
<li><p><strong>Generate a Collection of JSON files</strong></p>
<blockquote>
<pre><code class="lang-javascript">var SimpleTime = require(&#39;simpleTime&#39;), t;
t = SimpleTime.getYMDArrDate([&#39;2013&#39;, &#39;4&#39;, &#39;4&#39;]);
t = SimpleTime.getDayFromDate(t, 4);
console.log(t.getDate()); // 8</code></pre>
</blockquote>
</li>
</ol>
<hr>
<h4><a id="modifiers">Modifiers:</h4>
<ul>
<li><p><strong>--inputPath= <em>path</em></strong>, <em>default: ./JSONlocale/main</em>  </p>
<p>a systempath to a directory or file.</p>
</li>
<li><p><strong>--outputPath= <em>path</em></strong>, <em>default: ./JSONlocaleNew</em>  </p>
<p>a systempath to a directory or file.</p>
</li>
<li><p><strong>--keep= <em>item</em>, <em>anotheritem</em></strong>, <em>default: allItems</em>     </p>
<p>direct json-local to keep specific items. if no items are specified, all items are kept. available items are elements of the <code>keep</code> array:</p>
<blockquote>
<pre><code class="lang-javascript">keep : [
  &quot;identity&quot;,
  &quot;languages&quot;,
  &quot;scripts&quot;,
  &quot;territories&quot;,
  &quot;variants&quot;,
  &quot;keys&quot;,
  &quot;types&quot;,
  &quot;measurements&quot;,
  &quot;codePatterns&quot;,
  &quot;layouts&quot;,
  &quot;characters&quot;,
  &quot;calendars&quot;,
  &quot;currencies&quot;,
  &quot;numbers&quot;,
  &quot;units&quot;
];</code></pre>
</blockquote>
</li>
<li><p><strong>--keepCalendars= <em>item</em>, <em>anotheritem</em></strong>, <em>default: allItems</em>     </p>
<p>direct json-local to keep specific items. if no items are specified, all items are kept. available items are elements of the <code>keepCalendars</code> array: </p>
<blockquote>
<pre><code class="lang-javascript">keepCalendars : [
  &quot;buddhist&quot;, 
  &quot;chinese&quot;, 
  &quot;coptic&quot;, 
  &quot;dangi&quot;,
  &quot;ethiopic&quot;, 
  &quot;ethiopicAmeteAlem&quot;,
  &quot;gregorian&quot;,
  &quot;hebrew&quot;, 
  &quot;indian&quot;,
  &quot;islamic&quot;, 
  &quot;islamicCivil&quot;, 
   &quot;japanese&quot;,
  &quot;persian&quot;, 
  &quot;roc&quot;
];</code></pre>
</blockquote>
</li>
<li><p><strong>--keepCalendarItems= <em>item</em>, <em>anotheritem</em></strong>, <em>default: allItems</em>      </p>
<p>direct json-local to keep specific items. if no items are specified, all items are kept. available items are elements of the <code>keepCalendarsItems</code> array:  </p>
<blockquote>
<pre><code class="lang-javascript">keepCalendarsItems : [
  &quot;months&quot;,
  &quot;days&quot;,
  &quot;quarters&quot;,
  &quot;eras&quot;,
  &quot;dateFormats&quot;,
  &quot;timeFormats&quot;,
  &quot;dateTimeFormats&quot;,
  &quot;fields&quot;      
];</code></pre>
</blockquote>
</li>
<li><p><strong>--keepNumberItems= <em>item</em>, <em>anotheritem</em></strong>, <em>default: allItems</em>      </p>
<p>direct json-local to keep specific items. if no items are specified, all items are kept. available items are elements of the <code>keepNumbersItems</code> array:   </p>
<blockquote>
<pre><code class="lang-javascript">keepNumbersItems : [
  &quot;currencyFormatsNumberSystemLatn&quot;,
  &quot;symbolsNumberSystemLatn&quot;,
  &quot;decimalFormatsNumberSystemLatn&quot;,
  &quot;currencies&quot;
]</code></pre>
</blockquote>
</li>
</ul>
<hr>
<h4><a id="license">License:</h4>
<p>(The MIT License)</p>
<p>Copyright (c) 2013 <a href="http://www.bumblehead.com" title="bumblehead">Bumblehead</a> <a href="&#x6d;&#x61;&#x69;&#108;&#x74;&#111;&#x3a;&#99;&#x68;&#114;&#105;&#x73;&#64;&#x62;&#x75;&#109;&#98;&#x6c;&#101;&#104;&#x65;&#97;&#100;&#x2e;&#x63;&#x6f;&#109;">&#99;&#x68;&#114;&#105;&#x73;&#64;&#x62;&#x75;&#109;&#98;&#x6c;&#101;&#104;&#x65;&#97;&#100;&#x2e;&#x63;&#x6f;&#109;</a></p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &#39;Software&#39;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED &#39;AS IS&#39;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<hr>
<h4><a id="unicodeLicense">Unicode License:</h4>
<p>(The Unicode License) <a href="http://unicode.org/copyright.html">http://unicode.org/copyright.html</a></p>
<p>Unicode Copyright.<br>Copyright B) 1991-2013 Unicode, Inc. All rights reserved.<br>Certain documents and files on this website contain a legend indicating that &quot;Modification is permitted.&quot; Any person is hereby authorized, without fee, to modify such documents and files to create derivative works conforming to the UnicodeB. Standard, subject to Terms and Conditions herein.<br>Any person is hereby authorized, without fee, to view, use, reproduce, and distribute all documents and files solely for informational purposes in the creation of products supporting the Unicode Standard, subject to the Terms and Conditions herein.<br>Further specifications of rights and restrictions pertaining to the use of the particular set of data files known as the &quot;Unicode Character Database&quot; can be found in Exhibit 1.<br>Each version of the Unicode Standard has further specifications of rights and restrictions of use. For the book editions (Unicode 5.0 and earlier), these are found on the back of the title page. The online code charts carry specific restrictions. All other files, including online documentation of the core specification for Unicode 6.0 and later, are covered under these general Terms of Use.<br>No license is granted to &quot;mirror&quot; the Unicode website where a fee is charged for access to the &quot;mirror&quot; site.<br>Modification is not permitted with respect to this document. All copies of this document must be verbatim.<br>Restricted Rights Legend. Any technical data or software which is licensed to the United States of America, its agencies and/or instrumentalities under this Agreement is commercial technical data or commercial computer software developed exclusively at private expense as defined in FAR 2.101, or DFARS 252.227-7014 (June 1995), as applicable. For technical data, use, duplication, or disclosure by the Government is subject to restrictions as set forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov 1995) and this Agreement. For Software, in accordance with FAR 12-212 or DFARS 227-7202, as applicable, use, duplication or disclosure by the Government is subject to the restrictions set forth in this Agreement.<br>Warranties and Disclaimers.<br>This publication and/or website may include technical or typographical errors or other inaccuracies . Changes are periodically added to the information herein; these changes will be incorporated in new editions of the publication and/or website. Unicode may make improvements and/or changes in the product(s) and/or program(s) described in this publication and/or website at any time.<br>If this file has been purchased on magnetic or optical media from Unicode, Inc. the sole and exclusive remedy for any claim will be exchange of the defective media within ninety (90) days of original purchase.<br>EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR SOFTWARE IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE WEBSITE.<br>Waiver of Damages. In no event shall Unicode or its licensors be liable for any special, incidental, indirect or consequential damages of any kind, or any damages whatsoever, whether or not Unicode was advised of the possibility of the damage, including, without limitation, those resulting from the following: loss of use, data or profits, in connection with the use, modification or distribution of this information or its derivatives.<br>Trademarks &amp; Logos.<br>The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, Inc. bThe Unicode Consortiumb and bUnicode, Inc.b are trade names of Unicode, Inc. Use of the information and materials found on this website indicates your acknowledgement of Unicode, Inc.bs exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names.<br>The Unicode Consortium Name and Trademark Usage Policy (bTrademark Policyb) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc.<br>All third party trademarks referenced herein are the property of their respective owners.<br>Miscellaneous.<br>Jurisdiction and Venue. This server is operated from a location in the State of California, United States of America. Unicode makes no representation that the materials are appropriate for use in other locations. If you access this server from other locations, you are responsible for compliance with local laws. This Agreement, all use of this site and any claims and damages resulting from use of this site are governed solely by the laws of the State of California without regard to any principles which would apply the laws of a different jurisdiction. The user agrees that any disputes regarding this site shall be resolved solely in the courts located in Santa Clara County, California. The user agrees said courts have personal jurisdiction and agree to waive any right to transfer the dispute to any other forum.<br>Modification by Unicode Unicode shall have the right to modify this Agreement at any time by posting it to this site. The user may not assign any part of this Agreement without Unicodebs prior written consent.<br>Taxes. The user agrees to pay any taxes arising from access to this website or use of the information herein, except for those based on Unicodebs net income.<br>Severability.  If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain in effect.<br>Entire Agreement. This Agreement constitutes the entire agreement between the parties. </p>
<hr>
<h4><a id="unicodeTerms">Unicode Terms:</h4>
<p>(Unicode inc, License Agreement) <a href="http://unicode.org/copyright.html">http://unicode.org/copyright.html</a></p>
<p>EXHIBIT 1<br>UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE</p>
<p>Unicode Data Files include all data files under the directories <a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>, <a href="http://www.unicode.org/reports/">http://www.unicode.org/reports/</a>, and <a href="http://www.unicode.org/cldr/data/">http://www.unicode.org/cldr/data/</a>. Unicode Data Files do not include PDF online code charts under the directory <a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>. Software includes any source code published in the Unicode Standard or under the directories <a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>, <a href="http://www.unicode.org/reports/">http://www.unicode.org/reports/</a>, and <a href="http://www.unicode.org/cldr/data/">http://www.unicode.org/cldr/data/</a>.</p>
<p>NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.&#39;S DATA FILES (&quot;DATA FILES&quot;), AND/OR SOFTWARE (&quot;SOFTWARE&quot;), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.</p>
<p>COPYRIGHT AND PERMISSION NOTICE</p>
<p>Copyright B) 1991-2013 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in <a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a>.</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of the Unicode data files and any associated documentation (the &quot;Data Files&quot;) or Unicode software and any associated documentation (the &quot;Software&quot;) to deal in the Data Files or Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Data Files or Software, and to permit persons to whom the Data Files or Software are furnished to do so, provided that (a) the above copyright notice(s) and this permission notice appear with all copies of the Data Files or Software, (b) both the above copyright notice(s) and this permission notice appear in associated documentation, and (c) there is clear notice in each modified Data File or in the Software as well as in the documentation associated with the Data File(s) or Software that the data or software has been modified.</p>
<p>THE DATA FILES AND SOFTWARE ARE PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.</p>
<p>Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in these Data Files or Software without prior written authorization of the copyright holder.</p>
<p>Unicode and the Unicode logo are trademarks of Unicode, Inc. in the United States and other countries. All third party trademarks referenced herein are the property of their respective owners.</p>
npm loves you