Author:
caca...@gmail.com
Date: Sun Feb 1 01:41:58 2009
New Revision: 99
Added:
branches/CPRuleEditor/Localizer.j
branches/CPRuleEditor/RowObject.j
branches/CPRuleEditor/format.strings
Log:
Added 3 files
Added: branches/CPRuleEditor/Localizer.j
==============================================================================
--- (empty file)
+++ branches/CPRuleEditor/Localizer.j Sun Feb 1 01:41:58 2009
@@ -0,0 +1,51 @@
+@import <Foundation/Foundation.j>
+
+@implementation Localizer : CPObject
+{
+CPDictionary _dictionary;
+}
+
+-(id)initWithStrings:(CPString)strings
+{
+ self = [super init];
+ if(self != nil)
+ {
+ var dict = [CPDictionary dictionary];
+ CPLogConsole([strings className]);
+ var lines = [strings componentsSeparatedByString:"\n"];
+ CPLogConsole("lines ="+[lines className]);
+ var reg = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*");
+
+ CPLogConsole("RegExp = "+reg);
+
+ for(var i=0;i <[lines count];i++)
+ {
+ var line = [lines objectAtIndex:i];
+ if(line.length>1)
+ {
+ var match = reg.exec(line);
+ CPLogConsole(match[1]+"/"+match[2]+"length = "+match.length);
+
+ if(match.length == 3)
+ [dict setObject:match[2] forKey:match[1]];
+ }
+ }
+
+ _dictionary = [CPDictionary dictionaryWithDictionary:dict];
+ }
+ return self;
+}
+
+-(CPString)localizedStringForString:(CPString)aString
+{
+var localized;
+
+if(aString != nil)
+{
+CPLogConsole(_dictionary);
+ localized = [_dictionary objectForKey:aString];
+ if(localized != nil) return localized;
+}
+
+return aString;
+}
\ No newline at end of file
Added: branches/CPRuleEditor/RowObject.j
==============================================================================
--- (empty file)
+++ branches/CPRuleEditor/RowObject.j Sun Feb 1 01:41:58 2009
@@ -0,0 +1,7 @@
+@implementation RowObject : CPObject
+{
+CPArray subrows;
+CPArray criteria;
+CPArray displayValues;
+int rowType;
+}
\ No newline at end of file
Added: branches/CPRuleEditor/format.strings
==============================================================================
--- (empty file)
+++ branches/CPRuleEditor/format.strings Sun Feb 1 01:41:58 2009
@@ -0,0 +1,17 @@
+"CPLessThanPredicateOperatorType" = "is less than";
+"CPLessThanOrEqualToPredicateOperatorType" = "is less than or equal to";
+"CPGreaterThanPredicateOperatorType" = "is greater than";
+"CPGreaterThanOrEqualToPredicateOperatorType" = "is greater than or equal
to";
+"CPEqualToPredicateOperatorType" = "is equal to";
+"CPNotEqualToPredicateOperatorType" = "is not equal";
+"CPMatchesPredicateOperatorType" = "matches";
+"CPLikePredicateOperatorType" = "is like";
+"CPBeginsWithPredicateOperatorType" = "begins with";
+"CPEndsWithPredicateOperatorType" = "ends with";
+"CPInPredicateOperatorType" = "is in";
+"CPCustomSelectorPredicateOperatorType" = "function";
+"CPContainsPredicateOperatorType" = "contains";
+"CPBetweenPredicateOperatorType" = "is between";
+"firstName" = "First Name";
+"lastName" = "Last Name";
+"age" = "Age";