localization

NSLayoutManager boundingRect(forGlyphRange:in:) returns wrong value for RTL languages

只谈情不闲聊 提交于 2021-02-10 23:46:10
问题 In my app, I draw custom background under lines of text in UITextView . To do so, I use boundingRect(forGlyphRange:in:) method of NSLayoutManager . It works well for LTR languages (Latin, Cyrillic, Chinese etc): But if I use it for RTL texts (Hebrew, Farsi etc), the method returns wrong bounding rect (see padding on the left edge): These additional paddings seem to have some logic. The first character determines the size of the padding for a line: What the reason for this extra padding and

When date only is required to save, Converting it to UTC and then to local may behave differently in different time zones

假如想象 提交于 2021-02-10 19:52:54
问题 I have a date field at front end. And I am saving it from a time zone say 19/04/2018 and I am on +8. When I load it on local datetime.ToLocalTime() works perfectly in +8 offset and it will show 19/04/2018 but a person sitting in +7 would get in 18/04/2018 23:00 and hence it will show 18/04/2018. How to handle this case. 回答1: In general: you should not convert date only to UTC, so you should keep it as local date. But it really depend on the use of data. If you are using for some

Compile error with WPF .net Core 3.0 when adding .resx files

偶尔善良 提交于 2021-02-08 15:27:12
问题 Following works as expected: VS Studio 2019 tested with professional and community. Create new APF App (.NET Framework) Open properties Folder Change Resources.resx to public Create a new resources file (Resources.de.resx) Build Compiles as expected Following does not work: Create new APF App (.NET Core) Create a Resources Folder Create a new resources file (Resources.resx) Change it to public Create a new resources file (Resources.de.resx) Build Tested it on 3 different machines with VS 2019

localisation in RESTful services

六眼飞鱼酱① 提交于 2021-02-08 06:45:55
问题 I have a RESTful service that returns an enum. I was pondering whether to return integers or strings for an enum value, when it occurred to me that returning a string would depend on the locale of the client. So how should you handle localisation in REST? Is locale part of conneg? 回答1: Localisation is part of content negotiation, and language preferences are specified using the Accept-Language header (RFC). The RFC is quite strict about what the service is allowed to return here — for

Is there a way to localize php's error output?

守給你的承諾、 提交于 2021-02-08 04:48:40
问题 We're teaching a class in chinese (Mandarin). For our students, it would be easier (and make more sense to them) if the error output running php (on the commandline) was localizable to Mandarin. Is there a way to configure our php setup to support this (i.e. edit a php.ini file)? 回答1: I have downloaded the PHP source code and searched how the source handles it's errors. After going through a couple of (randomly picked) files and found these kinds of lines all over the place: // warning for

How to do localization in Google Closure

元气小坏坏 提交于 2021-02-07 20:25:56
问题 Currently I am using just plain text in my Closure application. I want to add localizations to those text. I just found several articles about goog.getMsg function which is used to do this kind of localization. As far as I understood it is done in compile time. How can we change language in run-time when user clicks a button? What is the easiest way to do this using Closure? 回答1: I have actually achieved a runtime i18n. I use .soy templates with {msg} tags in them. When you compile .soy to

How to do localization in Google Closure

醉酒当歌 提交于 2021-02-07 20:20:34
问题 Currently I am using just plain text in my Closure application. I want to add localizations to those text. I just found several articles about goog.getMsg function which is used to do this kind of localization. As far as I understood it is done in compile time. How can we change language in run-time when user clicks a button? What is the easiest way to do this using Closure? 回答1: I have actually achieved a runtime i18n. I use .soy templates with {msg} tags in them. When you compile .soy to

.NET Core - Globalization and Localization - Class library

假装没事ソ 提交于 2021-02-07 19:42:24
问题 Following this documentation on how to implement globalization and localization using .NET Core, my goal is to store all my resources in a single global resource file located in a different project, (class library). Project 1 - Startup.cs public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName

Can a Google Apps Script Web App get the user's language and time zone?

十年热恋 提交于 2021-02-07 19:24:20
问题 Is there any possibility for a GAS published as a Web App executing under the identity of the active user and using the Ui Service for user interface to get the preferred language and time zone of the user? Session.getActiveUser() works but you only get the Email Session.getActiveUser().getEmail() . Session.getTimeZone() returns the time zone of the script, not of the user. Could there be a trick to get the web browser ID string with the language preference? 回答1: Session.getActiveUserLocale()

Localization with String interpolation in SwiftUI

岁酱吖の 提交于 2021-02-07 13:57:48
问题 I am trying to localize my SwiftUI Watch app. I don't have any problems with static strings. I use LocalizedKeyStrings in my Text views and add my translations in Localizable.strings files. For example: Text("history") in Localizable.strings: "history" = "Historique"; Result : "Historique" But I also want to localize stings using interpolation. For example: Text("startCustom \(format: "%.1f",customDistance)") In Localizable.strings, I have tried with different syntax: "startCustom %@" =