<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Challenges with Interval() format &amp; translation/internationalization (pt-BR) in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Challenges-with-Interval-format-translation-internationalization/m-p/133188#M9395</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem: get an interval and translate it to another language, my case is portuguese (pt-BR).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Documentation reference:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/InterpretationFunctions/interval_hash.htm" title="https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/InterpretationFunctions/interval_hash.htm"&gt;https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/InterpretationFunctions/interval_hash.htm&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Introduction/conventions-number-time-formats.htm" title="https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Introduction/conventions-number-time-formats.htm"&gt;https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Introduction/conventions-number-time-formats.htm&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;timestamp_0 = 20/07/2018 15:00:00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;timestamp_1 = 21/07/2018 17:00:00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;// note the 24H pattern &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to get "1 dia 02 horas", this is pt-BR translation for&amp;nbsp; "1 day 02 hours";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Try 1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Interval(timestamp_0 - timestamp_1, '&lt;SPAN style="color: #0f0f0f; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;D hh&lt;/SPAN&gt;')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// obviously it shows "1 02" as expected, ok&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Try 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;// getting days&lt;/P&gt;&lt;P&gt;Interval(timestamp_1 - timestamp_0, 'D')&lt;/P&gt;&lt;P&gt;&amp;nbsp; // solving plurals&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp; If(Interval(timestamp_1 - timestamp_0, 'D') &amp;gt; 1, ' dias', ' dia')&lt;/P&gt;&lt;P&gt;// getting hours&lt;/P&gt;&lt;P&gt;&amp;amp; Interval(timestamp_1 - timestamp_0, 'hh')&lt;/P&gt;&lt;P&gt;&amp;nbsp; // solving plurals&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp; If(Interval(timestamp_1 - timestamp_0, 'hh') &amp;gt; 1, ' horas', ' hora')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// It shows "1 dias 26 horas", so not as expected, and I didn't understood why I got "dias" instead of "dia"... so&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Try 3 (fancy and lazy way):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Replace(Interval(timestamp_1 - &lt;SPAN style="font-size: 13.3333px;"&gt;timestamp_0&lt;/SPAN&gt;, 'D hh') , ' ', 'd ') &amp;amp; 'h'&lt;/P&gt;&lt;P&gt;// shows "1d 02h", it is ok for pt-BR, en-US and many other languages&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, to get "1 dia 02 horas" I can implement a tedious and ugly code with many "replaces" and "Ifs". Not so fun.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a smartest way to do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: is there a way to put &lt;PRE&gt; in this editor? I mean, like Github or PhpBB fórums, etc.? It would be nice too.&lt;/PRE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Aug 2018 13:06:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-08-13T13:06:05Z</dc:date>
    <item>
      <title>Challenges with Interval() format &amp; translation/internationalization (pt-BR)</title>
      <link>https://community.qlik.com/t5/App-Development/Challenges-with-Interval-format-translation-internationalization/m-p/133188#M9395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem: get an interval and translate it to another language, my case is portuguese (pt-BR).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Documentation reference:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/InterpretationFunctions/interval_hash.htm" title="https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/InterpretationFunctions/interval_hash.htm"&gt;https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/InterpretationFunctions/interval_hash.htm&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Introduction/conventions-number-time-formats.htm" title="https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Introduction/conventions-number-time-formats.htm"&gt;https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Introduction/conventions-number-time-formats.htm&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;timestamp_0 = 20/07/2018 15:00:00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;timestamp_1 = 21/07/2018 17:00:00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;// note the 24H pattern &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to get "1 dia 02 horas", this is pt-BR translation for&amp;nbsp; "1 day 02 hours";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Try 1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Interval(timestamp_0 - timestamp_1, '&lt;SPAN style="color: #0f0f0f; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;D hh&lt;/SPAN&gt;')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// obviously it shows "1 02" as expected, ok&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Try 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;// getting days&lt;/P&gt;&lt;P&gt;Interval(timestamp_1 - timestamp_0, 'D')&lt;/P&gt;&lt;P&gt;&amp;nbsp; // solving plurals&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp; If(Interval(timestamp_1 - timestamp_0, 'D') &amp;gt; 1, ' dias', ' dia')&lt;/P&gt;&lt;P&gt;// getting hours&lt;/P&gt;&lt;P&gt;&amp;amp; Interval(timestamp_1 - timestamp_0, 'hh')&lt;/P&gt;&lt;P&gt;&amp;nbsp; // solving plurals&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp; If(Interval(timestamp_1 - timestamp_0, 'hh') &amp;gt; 1, ' horas', ' hora')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// It shows "1 dias 26 horas", so not as expected, and I didn't understood why I got "dias" instead of "dia"... so&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Try 3 (fancy and lazy way):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Replace(Interval(timestamp_1 - &lt;SPAN style="font-size: 13.3333px;"&gt;timestamp_0&lt;/SPAN&gt;, 'D hh') , ' ', 'd ') &amp;amp; 'h'&lt;/P&gt;&lt;P&gt;// shows "1d 02h", it is ok for pt-BR, en-US and many other languages&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, to get "1 dia 02 horas" I can implement a tedious and ugly code with many "replaces" and "Ifs". Not so fun.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a smartest way to do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: is there a way to put &lt;PRE&gt; in this editor? I mean, like Github or PhpBB fórums, etc.? It would be nice too.&lt;/PRE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 13:06:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Challenges-with-Interval-format-translation-internationalization/m-p/133188#M9395</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-13T13:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Challenges with Interval() format &amp; translation/internationalization (pt-BR)</title>
      <link>https://community.qlik.com/t5/App-Development/Challenges-with-Interval-format-translation-internationalization/m-p/133189#M9396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, you can try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15341896626266720" jivemacro_uid="_15341896626266720"&gt;
&lt;P&gt;=SubField(Interval(timestamp_1 - timestamp_0, 'D hh'),' ',1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // solving plurals&lt;/P&gt;
&lt;P&gt;&amp;amp; If(SubField(Interval(timestamp_1 - timestamp_0, 'D hh'),' ',1) &amp;gt; 1, ' dias ', ' dia ')&lt;/P&gt;
&lt;P&gt;// getting hours&lt;/P&gt;
&lt;P&gt;&amp;amp; SubField(Interval(timestamp_1 - timestamp_0, 'D hh'),' ',2)&lt;/P&gt;
&lt;P&gt;// solving plurals&lt;/P&gt;
&lt;P&gt;&amp;amp; If(SubField(Interval(timestamp_1 - timestamp_0, 'D hh'),' ',2) &amp;gt; 1, ' horas', ' hora')&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 dia 02 horas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't worry, be Qlik.&lt;/P&gt;&lt;P&gt;Tonial.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 19:50:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Challenges-with-Interval-format-translation-internationalization/m-p/133189#M9396</guid>
      <dc:creator>fernando_tonial</dc:creator>
      <dc:date>2018-08-13T19:50:11Z</dc:date>
    </item>
  </channel>
</rss>

