Hi, I'm testing Drupal 4.1.0rc and want to use a german translation.
I have a problem with the locale module. Sometimes there are two nearly identical phrases, only different in the case of some letters (example 'Delete account' and 'delete account'). For some reason only one of those phrases appears in the locale list, so I can't translate the other one.
Is this a bug?

Comments

Dries’s picture

It is easy to fix but we need a comparison operator that is (a) case-sensitive (or binary) and (b) ANSI SQL compliant.

Could someone try the queries below using PostgreSQL:

SELECT STRCMP('text', '<b>t</b>ext');<br />SELECT STRCMP('text', '<b>T</b>ext');<br />SELECT STRCMP('text', BINARY '<b>T</b>ext');<br />SELECT BINARY 'text' = BINARY '<b>t</b>ext';<br />SELECT BINARY 'text' = BINARY '<b>T</b>ext';

Using MySQL, this yields:

mysql> SELECT STRCMP('text', 'text');
+------------------------+
| STRCMP('text', 'text') |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.00 sec)

mysql> SELECT STRCMP('text', 'Text');
+------------------------+
| STRCMP('text', 'Text') |
+------------------------+
|                      1 |
+------------------------+
1 row in set (0.00 sec)

mysql> SELECT STRCMP('text', BINARY 'Text');
+-------------------------------+
| STRCMP('text', BINARY 'Text') |
+-------------------------------+
|                             1 |
+-------------------------------+
1 row in set (0.00 sec)

mysql> SELECT BINARY 'text' = BINARY 'text';
+-------------------------------+
| BINARY 'text' = BINARY 'text' |
+-------------------------------+
|                             1 |
+-------------------------------+
1 row in set (0.00 sec)

mysql> SELECT BINARY 'text' = BINARY 'Text';
+-------------------------------+
| BINARY 'text' = BINARY 'Text' |
+-------------------------------+
|                             0 |
+-------------------------------+
1 row in set (0.00 sec)

Note that the comments on this page in the MySQL manual suggest that STRCMP is not case-sensitive by default, which is why we'd need the BINARY prefix.

teamonkey’s picture

Do something along the lines of
SELECT ('text'='text');
Under MySQL?

drupal=> select ('text'='text');
 ?column?
----------
 t
(1 row)

drupal=> select ('text'='Text');
 ?column?
----------
 f
(1 row)

t and f refer to True and False, of course. I believe that PHP turns these into 1 and 0 on a select, but I'll have to check.

[teamonkey]

Dries’s picture

We can't (and that is exactly the problem we are trying to solve):

mysql> SELECT 'text' = 'Text';
+-----------------+
| 'text' = 'Text' |
+-----------------+
|               1 |
+-----------------+
1 row in set (0.00 sec)

Did any of the queries in my previous comment work using PostgreSQL?

teamonkey’s picture

No - there's no STRCMP function.

Not sure how to go about this. Maybe we need a wrapper funtion for both postgres and mysql?

[teamonkey]