So I'm using arabic in my app (in various text fields, etc.), but for some reason all my print statements print in arabic. For example if I print Date.now I get ٨:٤١:٢٩ +0000.
Nice but not ideal for my use case. How can I remedy this?
Going to edit scheme > run > app language
Once I set the app language - this did the trick.
Related
I have an app that is used to track/manage livestock. It currently supports one species, Sheep. We want to begin supporting multiple different species, like Goats, and Cattle. My first thought was to create something similar to NSLocalizedString(text, comment) like SpeciesString(text, species, comment) which would take the English string and the species name and translate the Sheep term Ram to the Cattle term Bull. And internal to that, I could use NSLocalizedString() to then further translate that to the proper language so that in the future I could support multiple languages as well.
I see that I can pass a tableName to NSLocalizedString() so that it will use a different file other than Localizeable.strings and that would allow me to programmatically pull values from a Spanish language file that is focused on Cattle instead of Sheep (something like Localizeable-sheep.strings and Localizeable-cattle.strings), but that won't help me with all of the text that is in the storyboard.
I know that there is built-in support for localization with the storyboard, but the problem I'm having is that when the text comes to my code, for example in viewDidLoad, it will already have been translated to the other language, for example Spanish. I would prefer to find a way to make the text in my views already have the right Language+Species combination by the time it gets to my code. But even if I did rely on programmatically swapping out the strings to use the right Species, the English will already been changed to Spanish and I'll get Carnero instead of Ram and if I try to pass that through to my SpeciesString() it won't match my underlying data, because my underlying data is keying off of the English version of the text.
Is there a way to create a custom language? I've seen this code that is used to change the localization language on the fly, and it works for swapping between en and es, but I can't create my own fake languages like en-sheep and es-sheep.
Is there either:
a) a way to create my own custom language so that the localization system will just pick my correct Language+Species combination?
or
b) a way to tell the Storyboard which table name/filename to pull strings from? So that instead of just having a strings file for my Main.storyboard be called es.lproj/Main.strings but I could instead have
es.lproj/Main-sheep.strings and es.lproj/Main-cattle.strings?
I think my inability to get my "custom language" to work was just an accidental oversight. I created an es-sheep.lproj/Main.strings and used the other SO post to programmatically set my language to es-sheep and it didn't seem to work...
... but it turned out that I had created those directories and files, but forgotten to add them to the project. Once I manually added them to the project, it started working and I was able to use my custom localizations.
I am coding and there is a long string that i cant be asked to type out every time i need to. How could I set a shortcut?
example_coding.bla(bla.bla) *starts typing long string*
Then it recognises the start of my long string so gives me the option to press tab and auto insert the rest of it?
This is using LaTeX in Atom, but would be great if it could be for any coding language.
I know you're asking for how to create a command, but it sounds like what you really want is a snippet. Since you haven't provided any information about your use case, I can't tell you what to put in your snippets.cson, but the Flight Manual has all the necessary information.
Is it possible to display my console output (in xcode) to iphone ?
For example: if in my code I write NSLog(#"hello\n"); I will be able to see it in the device
in the same way I see it in console. (and of-course next time next nslog should not erase the previous one ) some sort of redirect the console.
Use this macro
#define YourLog(PR) {NSLog(#"%#",PR); yourTextFld.text=[NSString stringWithFormat:#"%#%#",yourTextFld.text,PR] ; }
Remember you have to change with your txt field name if this macro dosent work use this idea with some tweaks wrote in hurry
Create a file that will keep on appending your logs.
Show this file in textfield or textview.
I'm trying to get a localized index like Contacts by using UILocalizedIndexedCollation. In Contacts when I change the language the index changes to match the language. However sectionIndexTitles always returns an english index.
I have tried this with a demo app I created and with 3_SimpleIndexedTableView, which is a demo app from Apple and neither app have a localized index.
I have tried creating a localization folder for the current locale (I used [[NSLocale autoupdatingCurrentLocale] localeIdentifier] to determine the current locale). This does not affect the index.
I've had a look for relevant plist settings by found nothing.
Am I missing something or does UILocalizedIndexedCollation only return an English collation?
You can also set Localized resources can be mixed = YES in Info.plist.
If the key is missing right click and choose Add Row.
Solved!
I didn't have a localization folder in my app bundle for the target language. I added sv.lproj (Swedish) and the collation worked as expected. The folder is empty, it's presence is all that's required for it to work.
I dont know what exactly i have to type in title for this ,i tried my best
anyway coming to topic
I am making one acc checker for that purpose ,i am sending user and pass from my bsskinedit1 and bsskinedit2
here is my code
s:='http:\\site.com..premlogin='+bsskinedit.text+'&password='+bsskinedit2.text
but it giving some error ,then i used showmessage whats wrong with it then i came with strange result
see below
observer after 4 & and p combining together and appearing as a some new symbol :(
can any one tell me why its coming like this ?
Your code (where you build the URL) is most likely correct (I guess the above has some typos?!), but when you display the URL in a label for instance, the & character is treated as indicator for an accelerator key.
By Windows design, accelerator keys
enable the user to access a menu
command from the keyboard by pressing
Alt along the appropriate letter,
indicated in your code by the
preceding ampersand (&). The character
after the and sign (&) appears
underlined in the menu.
If you want to display the & character itself, you have to set your string variable to &&.
By placing two ampesands together - you state that the character following the first one is not used as the accelerator - rather you actually want to get it (only one) displayed.
Just use your debugger if you want to see the real value that your string variables have, don't output them to a message box or the like... It may have side effects, as you can see.
Regarding the URL you build: I can't possibly know how it has to be correctly, but at least you should use the right slashes!
s := 'http://site.com...'
(All quotes from delphi.about.com)
In addition to what Mef said, you can use OutputDebugString to add your string to the event log in its raw form, so you don't need to modify it before displaying it. Delphi should capture those strings automatically if you're running from the debugger. If you aren't running it from Delphi you can use DebugView instead, which captures the messages from any running applications.