Skip to content

Commit

Permalink
added helper attribute for lang export
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Feb 12, 2018
1 parent e322300 commit 2fd6084
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions cdb/Lang.hx
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,15 @@ class Lang {

function buildSheetXml(s:SheetData, tabs, values : Array<Dynamic>, locFields:Array<LocField>) {
var id = null;
for( c in s.columns )
if( c.type == TId ) {
id = c;
break;
var helper = null;
for( c in s.columns ) {
switch( c.type ) {
case TId if( id == null ): id = c;
case TRef(_) if( helper == null ): helper = c;
default:
}
}
if( id != null ) helper = null;

var buf = new StringBuf();
var index = 0;
Expand All @@ -206,7 +210,13 @@ class Lang {
break;
}
if( !hasLoc ) continue;
buf.add('$tabs<$id>\n');
buf.add('$tabs<$id');
if( helper != null ) {
var hid = Reflect.field(o, helper.name);
if( hid != null )
buf.add(' ${helper.name}=\"$hid\"');
}
buf.add('>\n');
for( l in locs )
if( l.value != null && l.value != "" ) {
if( l.value.indexOf("<") < 0 )
Expand Down

0 comments on commit 2fd6084

Please sign in to comment.