i18n language translation in Alloy Titanium - localization

I have put i18n folder in app/assets/i18n/en/strings.xml as per guide and also I have declared the code in .tss and also in views.xml file in this way
i18n consists of
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="username">Username_Ar</string>
<string name="password">Password</string>
<string name="login">Login</string>
<string name="members_list">Members List</string>
<string name="organizations_list">Organizations List</string>
<string name="membership_number">Membership Number</string>
<string name="real_estate">real_estate</string>
</resources>
and view.xml
<TextField id="username_textField" hintText="L('username')" borderColor="Gray" borderStyle="Ti.UI.INPUT_BORDERSTYLE_ROUNDED" color="#336699" top="170" left="40" width="250" height="40"/>
And also I have tried to put the code in .tss file
“#password_label”:{
font:
{ fontSize:12 }
,
top: 300,
left: 100,
height: 30,
text:L(“password”)
}
But there is no success instead, the mobile view is removing that particular text as i have displayed in the image. (3 brown dots must have ‘username’,’password’ and password) but its empty.
Check this screenshots
https://jira.appcelerator.org/secure/attachment/51472/3.png
https://jira.appcelerator.org/secure/attachment/51473/4.PNG
issue already raised:
https://jira.appcelerator.org/browse/TC-4754

This is really gonna kidding me!
I just fixed the issue by Cleaning up the project. This Titanium is going to eat my brain lol!

Related

Resize Cancel Button

I'm normally in Angular / Cordova world, but now im pressured to edit a native plugin, which im using with Cordova.
Source of the plugin
https://github.com/wildabeast/BarcodeScanner/tree/master/src/ios
Can anyone explain me how I have to edit the files to manipulate the size of the cancel button.
scannerOverlay.xib
<object class="IBUINavigationItem" id="240626599">
<reference key="IBUINavigationBar" ref="1064216609"/>
<string key="IBUITitle">Barcode Scanner</string>
<object class="IBUIBarButtonItem" key="IBUILeftBarButtonItem" id="1053701234">
<string key="IBUITitle">Cancel</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIStyle">1</int>
<reference key="IBUINavigationItem" ref="240626599"/>
</object>

Create XML file in Xcode 8 Swift 3

I need to create code in Swift for iOS device, to create and save a local XML file. It's actually a KML file with waypoints for exporting to Google earth.
I found the API reference here: API Reference - Class - XMLDocument
But it lacks an example of how to use these functions. Other examples I find online are all in objective C, so I'm lost how to write the code.
If someone can show simple example of how to create the file and add some keys, childs etc, that would be awesome.
An example of what this KML output file will look like:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Waypoint Name.kml</name>
<StyleMap id="msn_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin</styleUrl>
</Pair>
</StyleMap>
<Style id="sn_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<ListStyle>
</ListStyle>
</Style>
<Style id="sh_ylw-pushpin">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<ListStyle>
</ListStyle>
</Style>
<Placemark>
<name>Waypoint Name</name>
<description>Description</description>
<LookAt>
<longitude>-114.4379986989632</longitude>
<latitude>62.47084160066127</latitude>
<altitude>0</altitude>
<heading>9.194188445440662e-10</heading>
<tilt>0</tilt>
<range>1000.000042077875</range>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#msn_ylw-pushpin</styleUrl>
<Point>
<gx:drawOrder>1</gx:drawOrder>
<coordinates>-114.4435573708376,62.46869255035281,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>

wix internall strings cannot be localize

Wix I18n Dev.The version of wixtoolset is V3.7.
And the Installer UI is created by UIExtension.
In the installation process, there are some UI strings cannot be localized. Such as "Copying new files" and so on. I searched these strings and there are laid in the wix source code(wix37-sources\src\ext\UIExtension\wixlib\WixUI_en-us.wxl), and wix has localized these strings.
It's confusing to me that wix has localized these strings, but it still displayed as English in the installation process. Even I replaced there strings in .wxl file ,it still displayed as English strings.
I tried the example of BdN3504.
the wxs file is the same as BdN3504.
the wxl file is
and you can see the status is still keep English.
My build environment is VS2010 & wix3.7. I don't know what's wrong with it....
I already answered this question here.
Either read that or check out the paragraph called Progress Bar Messages in Nick Ramirez' book WiX 3.6: A Developer's Guide to Windows.
The good people of packtpublishing are offering the chapter of his book containing that paragraph for free here:
Chapter 12: Localizing Your Installer. See page 329.
Another page of interest is this MSDN article: Standard Actions Reference which is also noted in the book.
Edit: Because of the comments I will post a working minimal example and a screenshot, so you see that it works:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="LocalizingErrors" Language="1034" Version="1.0.0.0" Manufacturer="SomeOne" UpgradeCode="7ddbcad4-98d9-4c2d-9ae6-6fdc47314947">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="no" />
<Feature Id="ProductFeature" Title="LocalizingErrors" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<!-- Custom Progress messages
Custom progress messages are defined by a table in the MSI called ActionText. However, by default
this table isn't included. Without it, the messages are the stock English versions.
To add the ActionText table with strings for progress messages, add a ProgressText element inside
a UI element for each standard action found in the Execute sequence. For example, to add a
localized message for the InstallFiles action, add the following markup to one of your wxs files:
-->
<UI>
<ProgressText Action="InstallFiles" Template="!(loc.InstallFilesTemplate)">!(loc.InstallFiles)</ProgressText>
<ProgressText Action="CreateShortcuts" Template="!(loc.CreateShortcutsTemplate)">!(loc.CreateShortcuts)</ProgressText>
<ProgressText Action="WriteRegistryValues" Template="!(loc.WriteRegistryValuesTemplate)">!(loc.WriteRegistryValues)</ProgressText>
<ProgressText Action="RegisterUser" Template="!(loc.RegisterUserTemplate)">!(loc.WriteRegistryValues)</ProgressText>
<ProgressText Action="RegisterProduct" Template="!(loc.RegisterProductTemplate)">!(loc.RegisterProduct)</ProgressText>
<ProgressText Action="PublishFeatures" Template="!(loc.PublishFeaturesTemplate)">!(loc.PublishFeatures)</ProgressText>
<ProgressText Action="PublishProduct" Template="!(loc.PublishProductTemplate)">!(loc.PublishFeatures)</ProgressText>
<ProgressText Action="InstallFinalize" Template="!(loc.InstallFinalizeTemplate)">!(loc.InstallFinalize)</ProgressText>
</UI>
<UIRef Id="WixUI_Minimal"/>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="LocalizingErrors" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent" Guid="92A175A0-D15D-48EC-B2E1-FD5848FB6430">
<File Id="somefile" Source="..\File.exe" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Accompanying this example, you have to have a localisation file for your Culture. You have to set the Culture in the project properties under Build->Cultures to build. In my case I named it es-es.wxl and the file contents follow:
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="es-es" xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="1252" Language="1034">
<String Id="Error_1311">Archivo no encontrado: [2]. Compruebe que el archivo existe y que puedes acceder a él.</String>
<String Id="InstallFiles">Installazione del archivos</String>
<String Id="InstallFilesTemplate">Archivo: [1], Tamaño de archivo: [6], Directorio: [9]</String>
<String Id="CreateShortcuts">Creacion de los atajos</String>
<String Id="CreateShortcutsTemplate">Atajo [1] creado</String>
<String Id="WriteRegistryValues">Escribir en registro</String>
<String Id="WriteRegistryValuesTemplate">Camino: [1], Nombre: [2], valor: [3]</String>
<String Id="RegisterUser">Registrar a los usuarios</String>
<String Id="RegisterUserTemplate">Usario: [1]</String>
<String Id="RegisterProduct">Registrar producto</String>
<String Id="RegisterProductTemplate">Producto: [1]</String>
<String Id="PublishFeatures">Publicar las características</String>
<String Id="PublishFeaturesTemplate">Caraterística: [1]</String>
<String Id="PublishProduct">Publicar el producto</String>
<String Id="PublishProductTemplate">Producto: [1]</String>
<String Id="InstallFinalize">Finalizar la instalación</String>
<String Id="InstallFinalizeTemplate">Finalizar [ProductName]</String>
</WixLocalization>
Lastly a Screenshot to show you that it works:
Another edit: To localize error strings, you simply have to define Error elements with the corresponding error numbers:
<UI>
<Error Id="1322">Una parte de la ruta de la carpeta no es válido. Se está vacío o supera la longitud permitida por el sistema.</Error>
<Error Id="1311">!(loc.Error_1311)</Error>
</UI>
The first error string is hard-coded, so that's not such a good solution. It's better to use localization files, as it is done in the second Error element.

How to resize the xib view of iphone application to fit to ipad in xcode

I created a simple calculator app in universal mode. I have two xib one for iphone and other for ipad. I created all my view design only in iphone, my ipad xib is blank. Now when I deployed my app for iphone in ipad, it comes in the size of iphone. I have choosen the autoresize option. Will I have to create same view of iphone in ipad xib for the correct display or is there any other way? This is how my app currently displays on ipad. I need it in a full screen mode.
EDIT: This is the sample source code of iphone xib. How should I modify this to fit for ipad?
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">10K549</string>
<string key="IBDocument.InterfaceBuilderVersion">1938</string>
<string key="IBDocument.AppKitVersion">1038.36</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">933</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBUIView</string>
<string>IBUIBarButtonItem</string>
<string>IBProxyObject</string>
<string>IBUIToolbar</string>
<string>IBUITextField</string>
<string>IBUITextView</string>
<string>IBUITableView</string>
<string>IBUITableViewCell</string>
<string>IBUIButton</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="843779117">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="774585933">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUITextField" id="234836822">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{12, 48}, {286, 31}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSNextKeyView" ref="1066176330"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText">0</string>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<int key="IBUITextAlignment">2</int>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIKeyboardType">4</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="1025764138">
<int key="type">1</int>
<double key="pointSize">14</double>
</object>
<object class="NSFont" key="IBUIFont" id="891898266">
<string key="NSName">Helvetica</string>
<double key="NSSize">14</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUIButton" id="1066176330">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{41, 102}, {50, 50}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSNextKeyView" ref="182110945"/>
<bool key="IBUIOpaque">NO</bool>
<int key="IBUITag">1</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">1</string>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="899681977">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
.
.
.
.
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">ViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="101.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="103.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="104.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="105.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="106.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="111.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="0.0" key="17.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="19.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="20.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="21.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="22.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="23.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="24.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="25.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="36.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="69.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="78.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="82.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="83.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="94.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">125</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">933</string>
</data>
</archive>
Right click on XIB.
Choose open as.
Choose Source code.
And in it modify following:
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{320, 480}</string>
<string>{480, 320}</string>
</object>
to:
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{768, 1024}</string>
<string>{1024, 768}</string>
</object>
That's it.
I suggest using AutoLayout. If you do your view with auto layout for iPhone it will look nearly the same on the iPad, just bigger. AutoLayout is pretty easy in XIBs.
The other possibility is to create a separate XIB for the iPad layout. If you do so just have a look at the other answers which describe how to do that easily.
You need to make two seprate xib and manage all buttons,textfiels and add all these in New Xib...
Way To Create Ipad Xib from iphone xib....
1)First copy iphone xib and paste just change the name like ~ipad.xib give and add it to the bundle
2)now you have an 2 xib 1 is for iphone and 1 is for ipad.
3)go to ipad xib right click on in it see open as -> open it in source code and then you have to find 320,480 value search that value in source code and change into
768,1024...
that's it do this way....
Yes!!! You have to create view for iPad also in other Xib file.
From Converting iPhone xib to iPad xib?
Refer Jag's answer..where he States that,
I was able to narrow it down to a few things, so here are the steps that worked for me:
1) Make a copy of the iPhone xib file and add it to your project
2) Right click the file (in xcode) and Open As > Source Code
3) The 2nd line should look like:
Replace with:
4) Search for "IBCocoaTouchFramework" and Replace all occurrences with "IBIPadFramework"
5) Save the file and Open As > Interface Builder - iOS
The file might still look like a regular iPhone xib, but for me, once I changed the Status Bar to "Black" in the Attributes inspector the rest of the xib just kind of "snapped" into an iPad xib
EDIT : You can also do in this way==>convert iphone App to IPad
1) Select the Universal option.
2) Transfer code from the existing iPhone project to the new project.
3) NOW,Make the xib files for iPad, and make the connections (IBOutlets).
Wherever you need platform specific features (eg. Popover, Split ViewController etc for iPad), put an IF statement to handle the device specific features.
In iPhone xib file change the target from iOS.CocoaTouch to iOS.CocoaTouch.iPad, and now if you open the file in interface builder, you will see settings for iPad.

Monodroid - How to include layouts?

I am looking at android documentation and if I want to use include and merge.
So I opened up eclipse and got it to extract some of the code out and it made in my layout this
<include layout="#layout/progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
and another file with
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:text="Loading..." android:layout_height="wrap_content" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:id="#+id/lblLoading" android:layout_marginLeft="180dp" android:layout_marginTop="240dp"></TextView>
<ProgressBar android:id="#+id/progBar" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginLeft="130dp" android:layout_marginTop="230dp"></ProgressBar>
</merge>
Yet when I try to do this in monodroid I get errors saying it can't find merge and include.
Do you have "warnings as errors" enabled? For code completion, Mono for Android includes an XSD for .axml files, and the XSD doesn't specify <include/> or <merge/>, and thus Visual Studio will generate a warning when those are used. Mono for Android doesn't care about them, though, and passes them through to aapt.
It would be useful if you could provide the exact error message.
try using
<ProgressBar android:progress.....
And continue, its more along the lines of messing around with different options.

Resources