Req Clean unused strings.
#13
EDIT:
Wrong: For checking duplicates:
Correct: Check and count if same string used more then once:
PHP Code:
import polib

LANGUAGE_FILE 
'strings.po'

PO_DICT = []
po polib.pofile(LANGUAGE_FILE)
for 
entry in po:
    
PO_ARRAY = {'msgctxt'entry.msgctxt.replace('#'''), 'msgid'entry.msgid}
    
PO_DICT.append(entry.msgid)


def has_duplicates(values):
    
# For each element, check all following elements for a duplicate.
    
for i in range(0len(values)):
        
count 1
        dup_str 
''
        
for x in range(1len(values)):
            if 
values[i] == values[x]:
                
count += 1
                dup_str 
values[i]
        if 
count is not 1:
            print 
dup_strcount

# Test the has_duplicates method.
print(has_duplicates(PO_DICT)) 

Output: http://xbmclogs.com/pcmn4pbuv
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average


Messages In This Thread
Clean unused strings. - by queeup - 2015-04-06, 17:44
RE: Clean unused strings. - by queeup - 2015-04-11, 16:11
RE: Clean unused strings. - by Ned Scott - 2015-04-17, 07:58
RE: Clean unused strings. - by queeup - 2015-04-19, 15:03
RE: Clean unused strings. - by da-anda - 2015-04-19, 17:35
RE: Clean unused strings. - by ronie - 2015-04-19, 19:04
RE: Clean unused strings. - by takoi - 2015-04-19, 22:00
RE: Clean unused strings. - by queeup - 2015-04-19, 22:55
Re: RE: Clean unused strings. - by Martijn - 2015-04-20, 02:10
RE: Clean unused strings. - by queeup - 2015-04-20, 10:53
RE: Clean unused strings. - by da-anda - 2015-04-20, 10:58
RE: Clean unused strings. - by da-anda - 2015-04-20, 10:55
RE: Clean unused strings. - by takoi - 2015-04-20, 11:18
RE: Clean unused strings. - by queeup - 2015-04-20, 11:03
RE: Clean unused strings. - by queeup - 2015-04-20, 12:06


Logout Mark Read Team Forum Stats Members Help
Clean unused strings.00