Sets of English Strings combined with Localization that supports UIStoryboard - ios

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.

Related

XCode Storyboard Localization Duplicate Strings Merge?

I am currently working on an iOS app and localizing it into multiple languages but have faced an annoying (not breaking) issue.
When i would add a new localization for my storyboard xcode will automatically populate the strings, which is very nice. The issue i am having is that i have multiple interfaces which both have a back button. The text on these is of course the same and their translations are as well.
The question i was wondering about, is it possible, without using strings.localizable, to somehow merge multiple object translations into one?
This is how it would currently look:
"Pnu-Ec-HAj.normalTitle" = "Back";
"Rtx-fT-rdc.normalTitle" = "Back";
But it would be way easier if there was a syntax such as
"Pnu-Ec-HAj.normalTitle", "Rtx-fT-rdc.normalTitle" = "Back";
(this syntax is not correct obviously)
I have looked around quite a while but have not found any answers to this question yet.
Thanks for reading.
I'd recommend referencing every text in your storyboard in code, and setting the text on viewDidLoad like, e.g.:
buyButton.titleLabel.text = NSLocalizedString(#"SHOP_BUY_BUTTON_TEXT",#"Button for buying product in detail view");
It's loads of work if you have huge storyboards, but in the end you have a clean Localizable.strings with concise keys and comments, providing necessary context for your translators.
I prefix the key with the section of the app, so for example SHOP_***, USER_SETTINGS_***, etc.
In addition, we use a service like OneSky to organize our translations online and update them from the cloud (not affiliated with them, and it's not without its teething problems either).
Unfortunately the .strings files are key-value files and, by nature, there must be a key (that is composed by the nib ID of the element followed by the property) and the associated string value.
As Apple describes in the precedent link:
The standard strings file format consists of one or more key-value pairs along with optional comments. The key and value in a given pair are strings of text enclosed in double quotation marks and separated by an equal sign.
then, your idea is not supported by the .strings files.
The only way to support that feature is by using the NSLocalizedString in code.

Multi language, intelligent link conversion

I'm pretty new to Umbraco, so my question may turn out to be pretty simple, but I wasn't able to find any simple guide on it online.
I'm building a simple website with one domain and structure as follows
Content
- en
-- products
-- contacts
- cs
-- produkty
-- kontakty
and so on. My first question is: since I want to accomplish some nice results in SEO, I need to (i) assign meta language to contents of "en" and "cs" nodes, as well as some keywords. How should I do this?
Second: Say that in the future, I decide to add a new language, ex. Russian. So what I would need to do is to make a copy of the "en" node and its contents while the links included in the newly created copy should be rewritten to point at the copy and not the original (original would be /en/anotherpage, which should be rewritten to /ru/anotherpage). Is this possible?
Thanks,
Ondrej
You could build the content structure as a single root node and then have multiple Language homepage nodes directly beneath the content root.
To assign a language, you could create a custom datatype that simply displays all the .Net cultures, e.g. en-GB, fr-FR etc. Include that data type as a field on the language homepage document type and then output this value in the markup on the homepage and each descendant.
In the Language homepage document type, you can add a textstring property called 'umbracoUrlName'. You can then use this property to override the Url name. E.g. So you could call the page www.domain.com/en/ instead of www.domain.com/en/english-home/
With regards to duplicating the site at a later date, this is a difficult one. If the links are created using data types like the media picker and uComponent's multi node tree picker, then you will have no option but to inherit the links from the copied branch. However, if the links are created dynamically in the Razor or XSLT, then you should be able to make the links relative to the Language homepage or the current page. E.g. in XSLT getting the children of the parent language homepage would be something like $currentPage/ancestors-or-self::* [#level = '2']/child::* . In other words you can avoid hard coding links by using a clever bit of relative traversal.
This should give you a good start on creating multilingual sites in Umbraco
http://our.umbraco.org/wiki/how-tos/running-multi-lingual-sites-under-a-single-domain
If you was to create a Russian version in the future you would do exactly what you have mentioned above, its that easy.
To set the language meta data I would store this in a property on the langauge root node eg: /en/ to get the language page property from any page:
var langNode = new Node(int.Parse(node.Path.Split(',')[1]));
langNode.GetProperty("languageCode");
As for copying the English version to the Russian version and fixing all the links, I'm not aware of anything in umbraco to help you with this, you could write something yourself to find all the links and node references and fix them. you could use the relations API to keep track of what was copied from where to where. You'll need to be aware that you could end up copying nodes more than once.
If you don't have too much data, manually fixing links may be quicker.

Amending Translation Values in CRM 2011 Outside of the Translation Files

I have received a requirement to amend the translations of the 'Add new..' and 'Add existing..' buttons in French. A typical default button is shown below:
The desired new translations are essentially to remove the gender neutrality (if my rather poor school French is correct!). So rather than 'Ajouter un(e)' we have 'Ajouter un'.
Unfortunately these button labels are not included in the standard translations file (Settings -> Customisations -> Export Translations).
Are there any other options available? Given the nature of the requirement, I am happy to consider pretty much any kind of hack. CRM must be generating these values from somewhere, any ideas where they are hidden?
Note: I profoundly disagree with this requirement for fairly obvious reasons and I am sure most people reading this question will as well. However, requirements are what they are and sometimes customers/clients just will not budge. This is one of those cases.
You can define the labels for CRM Ribbon controls. See Use Localized Labels with Ribbons.
In order to make this work, you need to export the ribbon definitions and identify where these controls are defined.
You should be able to define a CustomAction to override the definition of the existing control but include the label text you want to have instead of the default label text. See Define Custom Actions to Modify the Ribbon.
If you are already experienced with customizing the ribbon this shouldn't be too hard, but there is a signifcant learning curve when it comes to customizing the ribbon.

how to design a tag system for a localized website?

Let say i have a basic tagging system (for a craiglists "clone") such as:
Tag (id, tagname)
ad(id, title, body)
adTag(tag_id, article_id)
This will fit for a non-localized website but what will be the correct aproach for a website that is used by people speaking diferent languages?
Users probably will post ads in diferent languages in one same local area, so, maybe i should make some kind of synonym system that considers "job" and "trabajo" the same tag? But, what about users that only want to see ads in one language?
Catering for tags for all the different languages is probably just going to be trouble. Going with the idea where you treat all variations of a tag as one single type will probably simplify a lot of the issues (so you don't need to keep track of language-tag mappings on the fly, just do the conversion once and be done with it). If the user needs to search by language later on, then just stick a meta-tag for that particular language on when you save the post.
Of course, that leaves the question of what happens when a user uses tags from multiple languages... but I suppose you can always enforce one single language or something.
I can think of two possible solutions:
Add language field: Tag (id, tagname, lang) where you can specify the language for the tag
Change Tag to Tag(id) and use separate table for tag translations tagTranslations(tag_id, lang, tagname)
Note: But I think this is only needed, if your articles have multiple translations.

Localization of Reporting Services-Reports (.rdl / .rdlc-Files)

i need to localize a Reporting Services-report (.rdlc) and i would like to do it using a ressource-file (.resx).
I found pages like this and that and they use custom code to achieve their target.
But pages like Setting the Report Language Parameter in a URL give me the impression that localization in reports is possible without custom code.
So, it is possible to localize a Reporting Services-report without custom code ?
If so, is there a tutorial that explains how it's done?
What in the report do you want to localize?
values from the database? Those should be retrieved from the database in the appropriate language already
fixed labels and textboxes on the report? I have not yet seen any compelling way to doing this - you can either have
one report "skeleton" / template per language (and pick the one you need)
if the number of elements is manageable, define report parameters which you can set from the calling code, to set the labels and texts
use some custom .NET extension for handling localization
It's not really an awfully pretty picture, indeed - I'd be most interested in better solutions myself! (I typically need to support 3-4 languages for any report - and I'm using only server-based .RDL files, no .RDLC, so any localization that depends on client-side resource files is not usable in my case)
I would add one method when it comes to labels and textboxes:
Create a placeholder element within the textbox and use Expression field to
use a Switch clause , switching on the Language parameter.
It's not superpretty, but also works pretty well for 3-4 languages
I am passing parameters to the report for labels etc, and after adding the parameters to the report (using the menu option Report -> Parameters in VS2008) you can then use the values of these parameters to localise the labels. This is workiiing well enough, although it would be nicer to be abkle to refer to resource keys immediately from your form labels etc.

Resources