diff mbox

RFC: locale-source validation script

Message ID s9dlgnbe5a7.fsf@redhat.com
State New
Headers show

Commit Message

Mike FABIAN July 26, 2017, 12:44 p.m. UTC
Zack Weinberg <zackw@panix.com> wrote:

> - The complaints about "inappropriate character '\t'" are all caused
> by _unintentional_ tabs inside strings.  If you write
>
> message "xyz/
>          abc"
>
> the whitespace on the second line gets included in the string, which
> is not what you want.

Yes, at the moment we get for example:

$ LC_ALL=et_EE.UTF-8 locale -k postal_fmt
postal_fmt="%a%N		 %f%N		 %d%N		 %b%N		 %s%t%h%t%e%t%r%N	 %C-%z %T%N		 %c%N"

I’ll fix it like this, this is far more readable as well:


And it seems to work correctly:

bash-4.4# LC_ALL=et_EE.UTF-8 locale -k postal_fmt
postal_fmt="%a%N%f%N%d%N%b%N%s%t%h%t%e%t%r%N%C-%z %T%N%c%N"

> The linter currently only detects this when
> that indentation is done with tabs, but I think it should probably
> detect spaces as well.  If you _mean_ to put a tab in a string write
> <U0009>. :-)

Comments

Zack Weinberg July 26, 2017, 2:49 p.m. UTC | #1
On Wed, Jul 26, 2017 at 8:44 AM, Mike FABIAN <mfabian@redhat.com> wrote:
> Zack Weinberg <zackw@panix.com> wrote:
>
>> - The complaints about "inappropriate character '\t'" are all caused
>> by _unintentional_ tabs inside strings.  If you write
>>
>> message "xyz/
>>          abc"
>>
>> the whitespace on the second line gets included in the string, which
>> is not what you want.
>
> Yes, at the moment we get for example:
>
> $ LC_ALL=et_EE.UTF-8 locale -k postal_fmt
> postal_fmt="%a%N                 %f%N            %d%N            %b%N            %s%t%h%t%e%t%r%N        %C-%z %T%N              %c%N"
>
> I’ll fix it like this, this is far more readable as well:

Note that there's probably a bunch of similar cases where the
undesirable whitespace is just space characters, no tabs - my script
won't catch that.  (I won't be working on it today, but this is on my
list of things to fix.)

zw
diff mbox

Patch

diff --git a/localedata/locales/et_EE b/localedata/locales/et_EE
index 93392659f4..7f68dabc18 100644
--- a/localedata/locales/et_EE
+++ b/localedata/locales/et_EE
@@ -2229,13 +2229,7 @@  name_fmt    "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
 END LC_NAME
 
 LC_ADDRESS
-postal_fmt      "<U0025><U0061><U0025><U004E>/
-		 <U0025><U0066><U0025><U004E>/
-		 <U0025><U0064><U0025><U004E>/
-		 <U0025><U0062><U0025><U004E>/
-		 <U0025><U0073><U0025><U0074><U0025><U0068><U0025><U0074><U0025><U0065><U0025><U0074><U0025><U0072><U0025><U004E>/
-		 <U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025><U004E>/
-		 <U0025><U0063><U0025><U004E>"
+postal_fmt      "%a%N%f%N%d%N%b%N%s%t%h%t%e%t%r%N%C-%z %T%N%c%N"
 country_name    "<U0045><U0065><U0073><U0074><U0069>"
 country_post    "<U0045><U0045>"
 country_ab2     "<U0045><U0045>"