[ALOY-858] Alloy: Theme "i18n" and "platform" folders
GitHub Issue | n/a |
Type | New Feature |
Priority | Medium |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2015-02-11T15:09:55.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.7.0 |
Components | XML |
Labels | SupportTeam, notable |
Reporter | Fokke Zandbergen |
Assignee | Feon Sua Xin Miao |
Created | 2013-10-23T08:36:51.000+0000 |
Updated | 2016-06-28T15:02:31.000+0000 |
Description
I would like to be able to theme the i18n
and platform
folders so that for a white-label app I can keep all brand-specific stuff in the theme folder.
Use case
For example, the i18n strings would include brand-specific texts in multiple languages and the platform folder would include brand-specific Android themes and UrbanAirship configurations.
Implementation
It would be most ideal to not just overwrite the i18n
files, but really merge the strings in the XML. For the platform folder we could just overwrite files, just like we do for assets
and lib
with the Resources
folder.
Attachments
This would GREATLY improve things. The themes folders are a dream for this problem, but because they work so well it highlights the omission of i18n and platform folders. Whilst the theme folders can change the iOS splash screens, the Android versions (if dot nines) cannot be swapped as they are outside the scope of the app folder. Also any changes to custom android manifests are also not possible as they also sit in the platform folder. For iOS the language specific app names cannot be changes, nor the strings associated because they are in the i18n folder. Merging the i18n files would be ideal as noted in the description - this would give the best outcome. High priority request from me.
I can do a PR for simple overwrite like assets if you can get it in 1.3 that way. Have it locally. Merge of i18n would take more work and maybe relates to extract-i18n being moved out of the core?
Pull Request: https://github.com/appcelerator/alloy/pull/257 To test:
Run automated tests: jake app:run dir=testing/ALOY-858 platform=android
0 of 2 specs should fail
Text should read: Hello ALOY-858!
Image should show the Appcelerator "a"
On Android, the app's icon should be the Appcelerator "a"
Let's resolve this ticket without an intelligent i18n merge. I don't even know if that's desirable. I can open a new ticket to investigate that further.
Actually, merging i18n would be useless. Since you're writing from
/app/themes/mytheme/i18n
to/i18n
, the next time you compile the/i18n
folder would have the merged version. So the PR is good as it is. Hope it can be merged for 1.3Really looking forward to this feature, hoping you very talented people can get it sorted as soon as possible.
Passes all tests, appears to have no side effects. OK to merge.
We'll continue to track development here rather than on the other ticket. The ultimate solution will likely involve using the CLI pre/post hooks to create temporary files to be included in the final app build steps.
I strongly believe that including the tiapp.xml file into those files that can be included via theme folders would add the final hurdle to these two extra folder. Assuming each theme was aimed to provide the same base app but to different clients or markets then the appid and if required things like the google map api values would also need to swap over. The simplest solution would be to have tiapp.xml as one of the theme folder file and then that is used in place of the default tiapp.xml if found. I imagine many professional app houses have a need to manage several variations of one base app engine and having manual steps in the process lead to potentially dangerous miss-managed store releases. The idea of the theme folders are superb; adding i18n and platform folder is a great move and championed by myself - but the tiapp.xml is the final hurdle to complete the process.
PR: https://github.com/appcelerator/alloy/pull/459 Test app: https://github.com/feons/alloy/tree/ALOY-858/test/apps/testing/ALOY-858 Functional Test: 1. run the test app on android 2. the UI should look like the attach screenshot
The updated sample app attached includes a platform directory with custom Android theme. The app icon in the app's mytheme should override the app icon in the Android theme.
Some changes to the sample apps [~skypanther] uploaded: - modified the strings in app/i18n - updated the plugins/ti.alloy/hook/alloy.js file
PR merged
[~farwayer] we made a copy of the
i18n
andplatform
folders and put them inbuild
directory. So thei18n
andplatform
folders you see in thebuild
directory are the backups of the original folders from developer. Titanium looks for thei18n/platform
folder at the top level, so to use the mergedi18n/platform
for the build process, we have to temporarily overwrite them. After the Titanium build process, the merged files inapp/i18n
&app/platform
are deleted and developer's original files are copied back to the app folder.[~fmiao], I understood purpose of this manipulations. But do you not think that it is dangerous? And it isn't potential risk. From time to time I catch situation when
build/i18b
orbuild/platform
became empty for some reasons (error syncing tobuild
?) and after back syncing alloy erase my files. Also I can imagine that there can be problems with parallel building. I think we need more clever and secure way.Reopening for consideration of alternate ways to implement the desired functionality.
IMHO, It will be more correct if titanium will use
build/i18n
andbuild/platform
directories while building. So at any moment we can cleanbuild
directory without any chance to get irreparable consequences.I have opened TIMOB-17446 to resolve this at the build scripts level, which Alloy can then use to more safely and reliably theme these folders.
Excellent idea Tim
Any news, movement or love coming towards this ticket?
Dear Sir - sometime ago I used to be a ticket - now I appear to be a distant memory.
TIMOB-17446 is scheduled for the next sprint. Assuming that goes smoothly, we should be able to resolve this ticket shortly thereafter.
This ticket should be do-able now that TIMOB-17446 has been resolved. Though, it will add an SDK dependency which will need to be managed (backward compatibility for developers using older SDKs)
PR: https://github.com/appcelerator/alloy/pull/662 This PR also takes care of ALOY-967 & ALOY-1059
Functional review steps: 1. Install a 4.x version of the Titanium SDK and set it as your default 2. Create a new Alloy app 3. Copy the contents of the alloy_repo/test/apps/advanced/themes folder to my app 4. Copy the alloy_repo/test/projects/HarnessTemplate/i18n folder to my app's project directory 5. Modify the app's project_name/i18n/en/strings.xml to define a single key title the value of which is STOCK i18N 6. Copy the i18n folder to each of the blue, green, and dark theme folders 7. Modify each of theme's i18n/en/strings.xml files to set the title key equal to the theme's name 8. Modify index.xml, changing the first label to 9. Build the app -- the title bar label should match the active theme (green for iOS, dark for android, blue for others) 10. Update the config.json file to set a different theme for your platform and build again. The title should match your theme.
FR and CR passed, merged
This is marked as closed but there is still a big problem with it. These two root folders that are auto-generated during the build process do not get deleted during a project Clean. * project/platform * project/i18n Unless these two folders are manually deleted their contents do not update into the next app build. Anyone know of a ticket showing that the deletion of these two folders will be included in an future update? I know there has been discussion over how it is achieved as my suggestion was the first tried, then rejected, then realised it was the best solution at the time. However since then it was suggested these auto-generated folders be moved into the project/build itself. Sounds like a great idea, but does not doe this in Alloy 1.9.0, Ti CLI 5.0.9, Ti SDK 5.3.0.