I'm aware that UITextChecker is used to check for misspelled words, but can it be used to access the Thesaurus? For example, how can I check if a string is similar to another string. For example:
Is "Car" similar to "Vehicle".
Does iOS have a native thesaurus that can be used like the dictionary UITextChecker. If so how can it be accessed?
This isn't a post seeking recommendations, but rather asking if a native functionality exists within the iOS SDK, and if so, what can be used to access it (i.e UITextChcker).
The answer to this after no responses and my own research was: no. UITextChecker is just mainly used for spelling mistakes.
I've had to create my own Thesaurus and build my own class to check words against each other.
Related
I have an iPhone app with interface languages in Toki Pona and Dothraki, which do not have ISO 639-3 codes. According to the ISO 639-3 standard, you can use the range qaa-qtz to represent languages for local use, which I have done (Toki Pona = qtp, Dothraki = qdt), but still get the warning from XCode "Unrecognized Locale".
It seems like I might be able to extend the main bundle class, but looking over the documentation, nothing seems to relate to adding non-ISO languages. I'm also aware of the text "If necessary, you can use a language or locale code that is not known to the NSBundle class or Core Foundation bundle functions. For example, you could create your own language designators for a language that is not yet listed in the ISO conventions or available as a language in Xcode." at the end of https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html
In any case, I mostly want to get rid of this warning. Any help would be greatly appreciated!
https://forums.swift.org/t/proposal-ns-locale-identifiers-etc-should-have-custom-types/9367/8
have a look at the above link.
Check if the languages are added as Localizations
I believe I have a solution however slightly complicated one. You would need to create a setting option within the app to use those made up languages and to load them manually from a file when a user sets them. For example, let's say your app consists of one label and the user sets the option to the made-up language you would call a method to set the language and the text on that label would update accordingly. I don't know whether this makes sense to you?? Basically, if the user uses the made-up languages that would override any system localization they have. It is doable it would just take time to implement it.
I have this game, that contains a lot of text as speech. I would like to give the users the option of changing the language of the game to their preferred tongue.. Can anyone point me to a resource or give me a starting point to achieve this? String look-up table perhaps?
Thanks,
Jack
See Localizing String Resources in Internationalization Programming Topics. iOS has a built-in system for this using NSLocalizedString() and related functions.
See also String Resources in the Resource Programming Guide.
NSLocalizedString is of use here. Here is a simple tutorial on localization.
I need to create a symbolic link on iPhone devices programatically in order to avoid a lot of slow file copying. Is this possible to do and if so, how?
It's technically possible, via the NSFileManager class. Grab the singleton instance and then use any of the calls listed under 'Linking an Item' or 'Symbolic-Link Operations' (createSymbolicLinkAtPath:withDestinationPath:error: looks like a good candidate).
Using a link rather than a direct file was a method briefly used by developers to update their Default.png programmatically, but that specific use has been outlawed by Apple. Besides that I'm afraid I have to plead ignorance on any SDK usage restrictions.
Is there a good reference somewhere with all the C functions that can be used by default in iPhone development (I guess they lie in the Foundation framework)? I mean functions like:
arc4random(), cos(), sinf(), hypot(), sqrt(), sqrtf() etc...
They are so many considering their variations too (sin(), sinf()) and googling every single time is ineffective.
Thanks :)
XCode/Help/Documentation
Then look in the Core Library. You may need to subscribe to one or more documentation sets first. Check that you search is not limited to Objective-C also.
If you're looking for all of the math functions, they can be found in the header file
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/math.h
For more generic functions, in addition to the documentation, I often find it helpful to right-(or Control-)click on a function in my code and choose "Jump to Definition". This takes you to the related header, which might also have similar functions and constants.
The Apple iPhone OS Man Pages doc is the handiest guide for this kind of thing.
http://developer.apple.com/iphone/library/documentation/System/Conceptual/ManPages_iPhoneOS/
Unfortunately being HeaderDoc driven, there's no PDF version. I thought at one point Apple indexed these symbols in the Xcode docset API indexes, but they don't seem to be there now.
Good luck!
Is there a way to retrieve words randomly from the built in Dictionary through the SDK?
I can provide my own list of words but using the built in Dictionary allows for easy localization.
Unfortunately this is one of the areas of the iPhone that applications have no access to.
However there are a number of free dictionaries available that you could use as an alternative. It's easy enough to convert a text-based file into ansqlite database which then makes it super easy to pick words at random.
And yes, as you point out localization is a problem with this :(
No access is provided to the Spell Checker.
The iPhone checks for spelling in UITextField objects.
Create a UITextField as a user input area.
Declare your interface to conform to the protocol.
Add any other delegates and then utilize UITextChecker
It has stuff like availableLanguages, hasLearnedWord, learnWord, unlearnWord
It also has guessesForWordRange:inString:language that returns a list of words that are possible valid replacements for a misspelled word.
For more information check out the iPhone OS Reference Library on UITextChecker
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITextChecker_Class/Reference/Reference.html
DougPan
Lexicontext (my library) provides such functionality for English words, although not from the built-in dictionary, but from a WordNet instance that is built into it.