Titanium JIRA Archive
Alloy (ALOY)

[ALOY-858] Alloy: Theme "i18n" and "platform" folders

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusResolved
ResolutionFixed
Resolution Date2015-02-11T15:09:55.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.7.0
ComponentsXML
LabelsSupportTeam, notable
ReporterFokke Zandbergen
AssigneeFeon Sua Xin Miao
Created2013-10-23T08:36:51.000+0000
Updated2016-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

FileDateSize
ALOY858_updated.zip2014-06-24T05:12:59.000+00006188511
ALOY858.zip2014-06-23T20:59:20.000+00006132624
android.png2014-06-23T04:50:34.000+0000102710

Comments

  1. Malcolm Hollingsworth 2013-10-23

    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.
  2. Fokke Zandbergen 2013-10-23

    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?
  3. Fokke Zandbergen 2013-10-25

    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"

  4. Fokke Zandbergen 2013-10-25

    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.
  5. Fokke Zandbergen 2013-10-25

    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.3
  6. Malcolm Hollingsworth 2014-02-01

    Really looking forward to this feature, hoping you very talented people can get it sorted as soon as possible.
  7. Tim Poulsen 2014-03-10

    Passes all tests, appears to have no side effects. OK to merge.
  8. Tim Poulsen 2014-04-29

    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.
  9. Malcolm Hollingsworth 2014-05-02

    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.
  10. Feon Sua Xin Miao 2014-06-23

    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
  11. Tim Poulsen 2014-06-23

    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.
  12. Feon Sua Xin Miao 2014-06-24

    Some changes to the sample apps [~skypanther] uploaded: - modified the strings in app/i18n - updated the plugins/ti.alloy/hook/alloy.js file
  13. Tim Poulsen 2014-06-30

    PR merged
  14. Far 2014-07-28

  15. Feon Sua Xin Miao 2014-07-29

    [~farwayer] we made a copy of the i18n and platform folders and put them in build directory. So the i18n and platform folders you see in the build directory are the backups of the original folders from developer. Titanium looks for the i18n/platform folder at the top level, so to use the merged i18n/platform for the build process, we have to temporarily overwrite them. After the Titanium build process, the merged files in app/i18n & app/platform are deleted and developer's original files are copied back to the app folder.
  16. Far 2014-07-29

    [~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 or build/platform became empty for some reasons (error syncing to build?) 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.
  17. Tim Poulsen 2014-07-29

    Reopening for consideration of alternate ways to implement the desired functionality.
  18. Far 2014-07-31

    IMHO, It will be more correct if titanium will use build/i18n and build/platform directories while building. So at any moment we can clean build directory without any chance to get irreparable consequences.
  19. Tim Poulsen 2014-08-01

    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.
  20. Fokke Zandbergen 2014-08-02

    Excellent idea Tim
  21. Malcolm Hollingsworth 2014-12-29

    Any news, movement or love coming towards this ticket?
  22. Malcolm Hollingsworth 2015-01-16

    Dear Sir - sometime ago I used to be a ticket - now I appear to be a distant memory.
  23. Tim Poulsen 2015-01-16

    TIMOB-17446 is scheduled for the next sprint. Assuming that goes smoothly, we should be able to resolve this ticket shortly thereafter.
  24. Tim Poulsen 2015-01-30

    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)
  25. Feon Sua Xin Miao 2015-02-10

    PR: https://github.com/appcelerator/alloy/pull/662 This PR also takes care of ALOY-967 & ALOY-1059
  26. Tim Poulsen 2015-02-11

    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.
  27. Tim Poulsen 2015-02-11

    FR and CR passed, merged
  28. Malcolm Hollingsworth 2016-06-28

    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.

JSON Source