天道酬勤,学无止境

localized

TimeSpan to Localized String in C#

Is there an easy way (maybe built in solution) to convert TimeSpan to localized string? For example new TimeSpan(3, 5, 0); would be converted to 3 hours, 5minutes (just in polish language). I can of course create my own extension: public static string ConvertToReadable(this TimeSpan timeSpan) { int hours = timeSpan.Hours; int minutes = timeSpan.Minutes; int days = timeSpan.Days; if (days > 0) { return days + " dni " + hours + " godzin " + minutes + " minut"; } else { return hours + " godzin " + minutes + " minut"; } } But this gets complicated if i want to have proper grammar involved.

2022-04-05 10:20:54    分类:问答    c#   timespan   localized

HTTPURLResponse.localizedString(forStatusCode:) not in development language

I am making an iOS app, and I have this problem. My app most be only in Spanish, so i changed the development language (in the hard way, changing the developmentRegion = es; inside the the project.pbxproj and changing the CFBundleDevelopmentRegion=es in the Info.plist) I also add a Localizable.strings to my only language (es) to have all the Strings inside one document. And all my NSLocalizedStrings works fine The problem comes out when i use the function HTTPURLResponse.localizedString(forStatusCode:) it only give me back Strings in English. Previously works fine, but after added the

2022-02-08 01:21:20    分类:问答    ios   swift   localized   nshttpurlresponse

如何编写本地化的屏幕键盘(How to write an localized on-screen-keyboard)

问题 我必须为我们公司的程序编写一个屏幕键盘,该程序主要用于具有触摸功能的工业PC。 我们不能使用 windows 默认键盘,因为我们不需要键盘上的所有键。 所以我被要求用 C# 编写一个自定义的。 我已经找到这个博客作为参考,但我不知道如何开始。 我创建了一个小型原型 GUI 并为每个键分配一个扫描码,并将这些扫描码转换为相关字符。 并将它们发送到主动控件。 但我不确定我应该使用什么扫描码。 所以我的问题是,这是编写这样的 OSK 的正确方法吗?如果是,我应该使用哪些扫描码? 有链接吗? 我也不确定如何处理换档状态...... 编辑: 好吧,我做了更多的研究,并提出了一个 osk,它可以读取当前的键盘布局,甚至可以处理简单的shift状态( Shift和Alt Gr )。 我写了一个KeyButton其继承类Button ,这KeyButton有一个ScanCode型字节的属性,如果你指定一个有效的扫描码到它时, KeyButton将调用相关功能,以获得正确的文本。 我使用了 Michael Kaplan 博客中的函数,并做了一些小改动。 最后我发现我只需要像他一样做。 所以我的问题的答案是:是的,您必须在按钮上使用扫描码,然后从键盘布局中获取虚拟键和 unicode。 使用这些扫描码。 现在我得到了角色,剩下的唯一事情就是发送这些角色。 回答1 我认为这相当简单

2021-10-20 19:40:29    分类:技术分享    c#   windows   keyboard   screen   localized

Localized App Icons with Retina Display for iOS

I have issues showing a localized app icon with retina display support. How could this be done? I tried to make Icon.png and Icon@2x.png localized, then I tried to make the proj-Info.plist localized and try to link to different Images. But only the Icon of the project language are being shown...

2021-06-26 18:53:20    分类:问答    iphone   ios   icons   localized

组合不同语言的两个字符串 RTL 和 LTR(Combine Two String in different Language RTL & LTR)

问题 我有两份文本,一份是希伯来语,一份是英文。 在第一个文本中,我的日期是希伯来语。 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSLocale *hebrew = [[NSLocale alloc] initWithLocaleIdentifier:@"he_IL"]; // Hebrew [dateFormatter setDateFormat:@"yyyy-MM-dd'T'hh:mm:ss.SSSZ"]; NSDate *date = [dateFormatter dateFromString:model.startDate]; NSLog(@"%@", date); [dateFormatter setDateFormat:@"EEEE,dd.MM.yyyy"]; dateFormatter.locale = hebrew; NSString *strDate = [dateFormatter stringFromDate:date]; 和开始日期是:星期五,19.08.2016 在 NString 对象 strDate 另一方面,我在 NSString 对象 timeForRequest 中有文本07: 00-16: 00 我需要的格式是Monday, 15.01.2016 | 16

2021-06-24 23:59:14    分类:技术分享    ios   nsstring   localized

How to write an localized on-screen-keyboard

I have to write an on screen keyboard for our company's program, which is mostly used on industry's PCs with touch capability. We can't use the windows default keyboard because we don't need all keys on the keyboard. So I was asked to write a custom one in C#. I already found this blog as reference, but I'm not sure how to start. I created a small prototype GUI and assign for each key a scancode, and translate these scancodes to the related character. And send them to the active control. But I'm not sure what scancodes I should use. So my question is, is that the correct way to write a OSK

2021-06-10 04:07:32    分类:问答    c#   windows   keyboard   screen   localized

Combine Two String in different Language RTL & LTR

I have two text, one in Hebrew language and one in English. In first text I have date that is in Hebrew. NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSLocale *hebrew = [[NSLocale alloc] initWithLocaleIdentifier:@"he_IL"]; // Hebrew [dateFormatter setDateFormat:@"yyyy-MM-dd'T'hh:mm:ss.SSSZ"]; NSDate *date = [dateFormatter dateFromString:model.startDate]; NSLog(@"%@", date); [dateFormatter setDateFormat:@"EEEE,dd.MM.yyyy"]; dateFormatter.locale = hebrew; NSString *strDate = [dateFormatter stringFromDate:date]; and start Date is : יום שישי,19.08.2016 in NString object strDate

2021-04-04 23:32:18    分类:问答    ios   nsstring   localized