[GH-ISSUE #132] Remove duplicate keys #109

Closed
opened 2026-02-25 21:34:11 +03:00 by kerem · 7 comments
Owner

Originally created by @DylanMeeus on GitHub (Oct 6, 2016).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/132

There are some duplicate keys in the i18n files, sometimes with the same case.
Created a small script to check duplicates: https://github.com/DylanMeeus/PHPi18n-duplicate-checker/blob/master/checker.hs

output for the en.php file

(key, # occurance respecting case, # occurance ignoring case)
(a 1 means 'no duplicate', 2,3,... means x duplicates)

Source => 1,  case insensitive: 2
Message list => 1,  case insensitive: 2
Account name => 1,  case insensitive: 2
Change password => 1,  case insensitive: 2
All => 1,  case insensitive: 2
source => 1,  case insensitive: 2
forward => 1,  case insensitive: 2
attach => 1,  case insensitive: 2
Account Name => 1,  case insensitive: 2
Unsaved Changes => 1,  case insensitive: 2
Author => 1,  case insensitive: 2
Create Account => 1,  case insensitive: 2
all => 1,  case insensitive: 2
reply => 1,  case insensitive: 2
author => 1,  case insensitive: 2
Display Name => 1,  case insensitive: 2
Create account => 1,  case insensitive: 2
Change Password => 1,  case insensitive: 2
Attach => 1,  case insensitive: 2
Contact Added => 1,  case insensitive: 2
New Folder Name => 2,  case insensitive: 2
Message List => 1,  case insensitive: 2
Reply => 1,  case insensitive: 2
Forward => 1,  case insensitive: 2
Contact added => 1,  case insensitive: 2
WordPress connection deleted => 1,  case insensitive: 2
Wordpress connection deleted => 1,  case insensitive: 2
Display name => 1,  case insensitive: 2
Unsaved changes => 1,  case insensitive: 2

One (New Folder Name) is in there twice with the same case.

I'm assuming the other language files are based on the English and have the same duplicate keys but I did not check that yet.


Originally created by @DylanMeeus on GitHub (Oct 6, 2016). Original GitHub issue: https://github.com/cypht-org/cypht/issues/132 There are some duplicate keys in the i18n files, sometimes with the same case. Created a small script to check duplicates: https://github.com/DylanMeeus/PHPi18n-duplicate-checker/blob/master/checker.hs output for the en.php file (key, # occurance respecting case, # occurance ignoring case) (a 1 means 'no duplicate', 2,3,... means x duplicates) ``` Source => 1, case insensitive: 2 Message list => 1, case insensitive: 2 Account name => 1, case insensitive: 2 Change password => 1, case insensitive: 2 All => 1, case insensitive: 2 source => 1, case insensitive: 2 forward => 1, case insensitive: 2 attach => 1, case insensitive: 2 Account Name => 1, case insensitive: 2 Unsaved Changes => 1, case insensitive: 2 Author => 1, case insensitive: 2 Create Account => 1, case insensitive: 2 all => 1, case insensitive: 2 reply => 1, case insensitive: 2 author => 1, case insensitive: 2 Display Name => 1, case insensitive: 2 Create account => 1, case insensitive: 2 Change Password => 1, case insensitive: 2 Attach => 1, case insensitive: 2 Contact Added => 1, case insensitive: 2 New Folder Name => 2, case insensitive: 2 Message List => 1, case insensitive: 2 Reply => 1, case insensitive: 2 Forward => 1, case insensitive: 2 Contact added => 1, case insensitive: 2 WordPress connection deleted => 1, case insensitive: 2 Wordpress connection deleted => 1, case insensitive: 2 Display name => 1, case insensitive: 2 Unsaved changes => 1, case insensitive: 2 ``` One (New Folder Name) is in there twice with the same case. I'm assuming the other language files are based on the English and have the same duplicate keys but I did not check that yet. ---
kerem 2026-02-25 21:34:11 +03:00
  • closed this issue
  • added the
    I18N
    label
Author
Owner

@jasonmunro commented on GitHub (Oct 6, 2016):

There may be some variance in the other lang files, but in general they are based on the English one. Thanks for helping to clean this up, it's very appreciated!

<!-- gh-comment-id:252034398 --> @jasonmunro commented on GitHub (Oct 6, 2016): There may be some variance in the other lang files, but in general they are based on the English one. Thanks for helping to clean this up, it's very appreciated!
Author
Owner

@DylanMeeus commented on GitHub (Oct 6, 2016):

It seems that some keys need to be upper/lower cased? Though it is not consistent, for example the keys in the french file:

All => 'Tout'
all => 'tout'

But in spanish

All => Todo
all => Todo

(Just an example, I think it was that key). Do you want me to keep both in that case?

<!-- gh-comment-id:252115054 --> @DylanMeeus commented on GitHub (Oct 6, 2016): It seems that some keys need to be upper/lower cased? Though it is not consistent, for example the keys in the french file: All => 'Tout' all => 'tout' But in spanish All => Todo all => Todo (Just an example, I think it was that key). Do you want me to keep both in that case?
Author
Owner

@jasonmunro commented on GitHub (Oct 10, 2016):

We need to correlate the keys in the language file with the places they are used in the code, and then modify the calls in the code to only use one of them, then we can remove the other from the language file. Insofar as capitalization in the values, that is up to the translator and does not break anything so I'm not too worried about it.

I will work through your original list and update the calling code and the en.php file to eliminate the duplicates. Then we can apply that to the other language files.

<!-- gh-comment-id:252734070 --> @jasonmunro commented on GitHub (Oct 10, 2016): We need to correlate the keys in the language file with the places they are used in the code, and then modify the calls in the code to only use one of them, then we can remove the other from the language file. Insofar as capitalization in the values, that is up to the translator and does not break anything so I'm not too worried about it. I will work through your original list and update the calling code and the en.php file to eliminate the duplicates. Then we can apply that to the other language files.
Author
Owner

@jasonmunro commented on GitHub (Oct 10, 2016):

I have gone through the list and cleaned up the code and English lang file to remove all the duplicates you found (I think!). I would like to have one "version" of any given string, so no duplicates with only case differences if we can. I would love it if you could pull the latest and re-analyze for duplicates. If it looks good I will sync the other lang files.
Thanks!

<!-- gh-comment-id:252742927 --> @jasonmunro commented on GitHub (Oct 10, 2016): I have gone through the list and cleaned up the code and English lang file to remove all the duplicates you found (I think!). I would like to have one "version" of any given string, so no duplicates with only case differences if we can. I would love it if you could pull the latest and re-analyze for duplicates. If it looks good I will sync the other lang files. Thanks!
Author
Owner

@DylanMeeus commented on GitHub (Oct 10, 2016):

I have pulled the latest master and ran the script again. No duplicates are found in the English language file. 👍

<!-- gh-comment-id:252773517 --> @DylanMeeus commented on GitHub (Oct 10, 2016): I have pulled the latest master and ran the script again. No duplicates are found in the English language file. :+1:
Author
Owner

@jasonmunro commented on GitHub (Oct 11, 2016):

Excellent, thanks! I will get the other files synced up to the English file today.

<!-- gh-comment-id:252956281 --> @jasonmunro commented on GitHub (Oct 11, 2016): Excellent, thanks! I will get the other files synced up to the English file today.
Author
Owner

@jasonmunro commented on GitHub (Oct 11, 2016):

Just synced all the other files. I think we are good to go on this. Thanks again for the help!

<!-- gh-comment-id:253017003 --> @jasonmunro commented on GitHub (Oct 11, 2016): Just synced all the other files. I think we are good to go on this. Thanks again for the help!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#109
No description provided.