Skip to content

Commit

Permalink
Fix replacing of names in generator (#277)
Browse files Browse the repository at this point in the history
* Fix replacing of names in generator

* serialize only main language

* Remove unuseful comment
  • Loading branch information
wurzka authored Sep 8, 2023
1 parent 4fa3466 commit 40013d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 58 deletions.
24 changes: 0 additions & 24 deletions src/z_generate_json_schema.prog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,6 @@
<LENGTH>38</LENGTH>
</item>
</TPOOL>
<I18N_TPOOL>
<item>
<LANGUAGE>D</LANGUAGE>
<TEXTPOOL>
<item>
<ID>I</ID>
<KEY>000</KEY>
<ENTRY>Einstellungen</ENTRY>
<LENGTH>17</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>001</KEY>
<ENTRY>Verwaiste Daten löschen:</ENTRY>
<LENGTH>42</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>Testlauf</ENTRY>
<LENGTH>70</LENGTH>
</item>
</TEXTPOOL>
</item>
</I18N_TPOOL>
</asx:values>
</asx:abap>
</abapGit>
14 changes: 4 additions & 10 deletions src/z_generate_repo.prog.abap
Original file line number Diff line number Diff line change
Expand Up @@ -553,23 +553,17 @@ CLASS lcl_generator IMPLEMENTATION.
METHOD replace_names_in_string.
DATA(string_content) = content_as_string.
LOOP AT replacing_table_string ASSIGNING FIELD-SYMBOL(<replace_string>).
FIND ALL OCCURRENCES OF <replace_string>-to_be_replaced IN string_content IGNORING CASE RESULTS DATA(table).
FIND ALL OCCURRENCES OF <replace_string>-to_be_replaced IN string_content IGNORING CASE RESULTS DATA(findings).
* replace all occurrences of <replace_string>-to_be_replaced in string_content with <replace_string>-replace_with ignoring case.
DATA(counter_replaced) = 0.
LOOP AT table ASSIGNING FIELD-SYMBOL(<finding>).
LOOP AT findings ASSIGNING FIELD-SYMBOL(<finding>) step -1.
IF <finding>-offset > 0.
DATA(offset) = <finding>-offset + counter_replaced.
DATA(before_offset) = offset - 1.
DATA(before_offset) = <finding>-offset - 1.
DATA(char_before_offset) = to_lower( string_content+before_offset(1) ).
ELSE.
char_before_offset = ' '.
offset = 0.
ENDIF.
IF NOT to_lower( char_before_offset ) EQ 'z'.
* string_content = insert( val = string_content sub = 'z' off = offset ).
* make the object names to lower
REPLACE SECTION OFFSET offset LENGTH <finding>-length OF string_content WITH <replace_string>-replace_with.
counter_replaced += 1.
REPLACE SECTION OFFSET <finding>-offset LENGTH <finding>-length OF string_content WITH <replace_string>-replace_with.
ENDIF.
ENDLOOP.
ENDLOOP.
Expand Down
24 changes: 0 additions & 24 deletions src/z_generate_repo.prog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,6 @@
<LENGTH>15</LENGTH>
</item>
</TPOOL>
<I18N_TPOOL>
<item>
<LANGUAGE>D</LANGUAGE>
<TEXTPOOL>
<item>
<ID>I</ID>
<KEY>000</KEY>
<ENTRY>Einstellungen</ENTRY>
<LENGTH>17</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>001</KEY>
<ENTRY>Verwaiste Daten löschen:</ENTRY>
<LENGTH>42</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>Testlauf</ENTRY>
<LENGTH>70</LENGTH>
</item>
</TEXTPOOL>
</item>
</I18N_TPOOL>
<LONGTEXTS>
<item>
<DOKIL>
Expand Down

0 comments on commit 40013d1

Please sign in to comment.