有没有办法设置在应用程序不支持设备UI语言时使用的默认语言?
示例:我的应用已本地化为英语和德语:
// en.lproj:
"POWER_TO_THE_PEOPLE_BTN" = "Power";
"POWER_PLUG_BTN" = "Power";
// de.lproj:
"POWER_TO_THE_PEOPLE_BTN" = "Macht";
"POWER_PLUG_BTN" = "Spannung";
Run Code Online (Sandbox Code Playgroud)
现在,如果我在设置为Italian
应用程序的UI语言的设备上运行应用程序将使用键字符串POWER_TO_THE_PEOPLE_BTN
和POWER_PLUG_BTN
.
必须有一种方法来指定应用程序在这种情况下使用的默认(回退)语言.
从上面的例子中可以清楚地看出,使用英文字符串作为键是行不通的.
我现在看到的唯一选择是使用NSLocalizedStringWithDefaultValue
而不是NSLocalizedString
.
我有一个奇怪的问题访问以下网址:
这是代码:
void WebRequestButton_Click( object sender, RoutedEventArgs e )
{
string url = "http://xn--fanbys-exa.org/episodes.m4a.rss";
if ( Uri.IsWellFormedUriString( url, UriKind.Absolute ) )
{
HttpWebRequest webRequest = ( HttpWebRequest )HttpWebRequest.Create( url );
if ( webRequest != null )
{
webRequest.BeginGetResponse( new AsyncCallback( ReadWebRequestCallback ), webRequest );
}
}
}
private void ReadWebRequestCallback( IAsyncResult callbackResult )
{
HttpWebRequest request = ( HttpWebRequest )callbackResult.AsyncState;
HttpWebResponse response = null;
try
{
response = ( HttpWebResponse )request.EndGetResponse( callbackResult );
}
catch ( Exception e ) …
Run Code Online (Sandbox Code Playgroud) 我有一个Objective-C/C++应用程序,它使用C++库提供的功能.
其中一个C++类包含这样的枚举:
class TheClass
{
public:
[...]
enum TheEnum
{
YES,
NO,
};
[...]
};
Run Code Online (Sandbox Code Playgroud)
包括(使用#import -if that matters-)带有Objective-C/C++源文件(*.mm)中的上述类声明的头文件将使编译失败,因为预处理器将用术语"替换"为"YES" (BOOL)1"("(BOOL)0"同样为"NO").
有没有办法解决这个问题而不重命名枚举的值?
PHP版本5.2.17
我有以下用于下载二进制文件的PHP脚本:
<?php
$download_dir = '.';
$download_file = $_GET['get'];
$path = $download_dir.'/'.$download_file;
if(file_exists($path))
{
$size = filesize($path);
header('Content-Type: application/x-download');
header('Content-Disposition: attachment; filename='.$download_file);
header('Content-Length: '.$size);
header('Content-Transfer-Encoding: binary');
readfile($path);
}else{
echo "<font face=$textfont size=3>";
echo "<center><br><br>The file [<b>$download_file</b>] is not available for download.<br>";
}
?>
Run Code Online (Sandbox Code Playgroud)
用于调用此脚本的URL:
HTTP://myserver/cur/downloads/test.php GET = FooBar_Setup.exe
下载有效但下载的文件附加了一个附加字节(0x0a).
响应的标头还显示Content-Length比所请求文件的大小大一个字节:
HTTP/1.1 200 OK
Date: Mon, 05 Dec 2011 10:29:32 GMT
Server: Apache/2.2
Content-Disposition: attachment; filename=FooBar_Setup.exe
Content-Length: 1417689
Content-Transfer-Encoding: binary
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/x-download
Run Code Online (Sandbox Code Playgroud)
服务器上文件的大小为1417688字节.
我已经验证 …