فهرست منبع

web intf: localize page title

Felix Paul Kühne 11 سال پیش
والد
کامیت
54d03c5aa8
2فایلهای تغییر یافته به همراه15 افزوده شده و 9 حذف شده
  1. 1 1
      Resources/web/style.css
  2. 14 8
      Sources/VLCHTTPConnection.m

+ 1 - 1
Resources/web/style.css

@@ -61,7 +61,7 @@ div.main.drop {
 }
 
 .nav:before {
-  content: "WiFi Upload";
+  content: "%%HTTP_UPLOAD%%";
   font-family: "Raleway", "Helvetica Neue";
   font-size: 36px;
   line-height: 60px;

+ 14 - 8
Sources/VLCHTTPConnection.m

@@ -104,8 +104,7 @@
     NSString *documentRoot = [config documentRoot];
     NSString *relativePath = [filePath substringFromIndex:[documentRoot length]];
 
-    if ([relativePath isEqualToString:@"/index.html"])
-    {
+    if ([relativePath isEqualToString:@"/index.html"]) {
         NSArray *allFiles = [MLFile allFiles];
         NSString *fileList = @"";
         for (MLFile *file in allFiles) {
@@ -113,17 +112,24 @@
             fileList = [fileList stringByAppendingString:fileHTML];
         }
 
-        NSMutableDictionary *replacementDict = [NSMutableDictionary new];
-        [replacementDict setObject:fileList forKey:@"FILES"];
-        [replacementDict setObject:NSLocalizedString(@"WEBINTF_DROPFILES", nil) forKey:@"WEBINTF_DROPFILES"];
-        [replacementDict setObject:NSLocalizedString(@"WEBINTF_DROPFILES_LONG", nil) forKey:@"WEBINTF_DROPFILES_LONG"];
-        [replacementDict setObject:NSLocalizedString(@"WEBINTF_DOWNLOADFILES", nil) forKey:@"WEBINTF_DOWNLOADFILES"];
-        [replacementDict setObject:NSLocalizedString(@"WEBINTF_DOWNLOADFILES_LONG", nil) forKey:@"WEBINTF_DOWNLOADFILES_LONG"];
+        NSDictionary *replacementDict = @{@"FILES" : fileList,
+                                          @"WEBINTF_DROPFILES" : NSLocalizedString(@"WEBINTF_DROPFILES", nil),
+                                          @"WEBINTF_DROPFILES_LONG" : NSLocalizedString(@"WEBINTF_DROPFILES_LONG", nil),
+                                          @"WEBINTF_DOWNLOADFILES" : NSLocalizedString(@"WEBINTF_DOWNLOADFILES", nil),
+                                          @"WEBINTF_DOWNLOADFILES_LONG" : NSLocalizedString(@"WEBINTF_DOWNLOADFILES_LONG", nil)};
+
+        return [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
+                                                   forConnection:self
+                                                       separator:@"%%"
+                                           replacementDictionary:replacementDict];
+    } else if ([relativePath isEqualToString:@"/style.css"]) {
+        NSDictionary *replacementDict = @{@"HTTP_UPLOAD" : NSLocalizedString(@"HTTP_UPLOAD", nil)};
         return [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
                                                    forConnection:self
                                                        separator:@"%%"
                                            replacementDictionary:replacementDict];
     }
+
     return [super httpResponseForMethod:method URI:path];
 }