@@ -84,38 +84,38 @@ get_po_messages <- function(po_file) {
8484
8585 msg_j = 1L
8686 while (msg_j < = length(msgid_start )) {
87- start = msgid_start [msg_j ]
88- end = find_msg_end(start )
89- set(po_data , msg_j , ' msgid' , build_msg(start , end , ' msgid' ))
87+ start_j = msgid_start [msg_j ]
88+ end_j = find_msg_end(start_j )
89+ set(po_data , msg_j , ' msgid' , build_msg(start_j , end_j , ' msgid' ))
9090
91- set(po_data , msg_j , ' fuzzy' , as.integer(start != 1L && startsWith(po_lines [start - 1L ], " #, fuzzy" )))
91+ set(po_data , msg_j , ' fuzzy' , as.integer(start_j != 1L && startsWith(po_lines [start_j - 1L ], " #, fuzzy" )))
9292
93- start = end + 1L
94- end = find_msg_end(start )
95- set(po_data , msg_j , ' msgstr' , build_msg(start , end , ' msgstr' ))
93+ start_j = end_j + 1L
94+ end_j = find_msg_end(start_j )
95+ set(po_data , msg_j , ' msgstr' , build_msg(start_j , end_j , ' msgstr' ))
9696 msg_j = msg_j + 1L
9797 }
9898
9999 plural_i = 1L
100100 while (plural_i < = length(msgid_plural_start )) {
101- start = msgid_plural_start [plural_i ]
102- end = find_msg_end(start )
103- msg1 = build_msg(start , end , ' msgid' )
101+ start_j = msgid_plural_start [plural_i ]
102+ end_j = find_msg_end(start_j )
103+ msg1 = build_msg(start_j , end_j , ' msgid' )
104104
105- set(po_data , msg_j , ' fuzzy' , as.integer(start != 1L && startsWith(po_lines [start - 1L ], " #, fuzzy" )))
105+ set(po_data , msg_j , ' fuzzy' , as.integer(start_j != 1L && startsWith(po_lines [start_j - 1L ], " #, fuzzy" )))
106106
107- start = end + 1L
108- end = find_msg_end(start )
109- msg2 = build_msg(start , end , ' msgid_plural' )
107+ start_j = end_j + 1L
108+ end_j = find_msg_end(start_j )
109+ msg2 = build_msg(start_j , end_j , ' msgid_plural' )
110110
111111 set(po_data , msg_j , ' msgid_plural' , list (c(msg1 , msg2 )))
112112
113- start = end + 1L
113+ start_j = end_j + 1L
114114 msgstr_plural = character ()
115- while (start < = po_length && startsWith(po_lines [start ], ' msgstr[' )) {
116- end = find_msg_end(start )
117- msgstr_plural = c(msgstr_plural , build_msg(start , end , ' msgstr\\ [\\ d+\\ ]' ))
118- start = end + 1L
115+ while (start_j < = po_length && startsWith(po_lines [start_j ], ' msgstr[' )) {
116+ end_j = find_msg_end(start_j )
117+ msgstr_plural = c(msgstr_plural , build_msg(start_j , end_j , ' msgstr\\ [\\ d+\\ ]' ))
118+ start_j = end_j + 1L
119119 }
120120 set(po_data , msg_j , ' msgstr_plural' , list (msgstr_plural ))
121121
@@ -125,11 +125,9 @@ get_po_messages <- function(po_file) {
125125
126126 # somewhat hacky approach -- strip the comment markers & recurse;
127127 # retain the same file pattern to ensure 'message_source' is correct
128- writeLines(
129- gsub(" ^#~ " , " " , grep(" ^#~ " , po_lines , value = TRUE )),
130- tmp <- tempfile(pattern = basename(po_file ))
131- )
128+ tmp <- tempfile(pattern = basename(po_file ))
132129 on.exit(unlink(tmp ))
130+ writeLines(gsub(" ^#~ " , " " , grep(" ^#~ " , po_lines , value = TRUE )), tmp )
133131 deprecated = get_po_messages(tmp )
134132 if (nrow(deprecated ) > 0L ) {
135133 set(deprecated , NULL , ' fuzzy' , 2L )
0 commit comments