- Adapted demo to use the local translator and xliff only.
- Added the demo content back, could not find a reasonable source for dummy content.
- The uninstall hook does not run through, I do not understand why. Please advise.
- The module is not hidden yet for testing purposes.

Comments

cgalli’s picture

This patch adds tmgmt_demo module. It sets up all necessary elements for a demo site.

By simply activating the 'Translation Management Core' module, all other needed modules are activated and settings and contents added.

Not yet tested with simplytest.me, as the patch is not yet up on d.o (it will be in a few minutes)

cgalli’s picture

StatusFileSize
new2.97 KB

here ist the patch....

cgalli’s picture

It does work on simplytest.me :-)

The url is: http://simplytest.me/project/tmgmt/7.x-1.x?patch[]=https://drupal.org/fi...

It takes a while to launch...

miro_dietiker’s picture

Great to see progress here! Some first review.

  1. +++ b/tmgmt.info
    @@ -6,6 +6,7 @@ core = 7.x
    +dependencies[] = tmgmt_demo
    

    I don't think this dependency direction was the idea.

  2. +++ b/tmgmt_demo.info
    @@ -0,0 +1,9 @@
    +name = Translation Management Demo
    

    Not hidden yet as suggested.

  3. +++ b/tmgmt_demo.module
    @@ -0,0 +1,71 @@
    +function tmgmt_demo_modules_installed($modules) {
    ...
    +    node_save($node);
    

    This is executed for every module enable completion. Later module enables might result in content duplicates added. May be add an early exit against multiple runs.

  4. +++ b/tmgmt_demo.module
    @@ -0,0 +1,71 @@
    +    // Set up MS Translator.
    ...
    +      $translator->settings['clientsecret'] = 'iur…';
    +      $translator->settings['clientid'] = 'bca…';
    

    MS? ;-) I see, this seems comfortable. But i guess it's against M$ license agreements to publish private keys.

    Also missing install of the local translator.

  5. +++ b/tmgmt_demo.module
    @@ -0,0 +1,71 @@
    +    $node = new stdClass();
    +    $node->title = 'Second node';
    

    How about using devel_generate? Not sure. But i guess we need more example cases.

cgalli’s picture

1) This is the only way to trigger the installation and activation of tmgmt_demo on Simplytest.me. If we want a ready-to-use demo system there, we need to make the patch self starting.

2) There is no need to ever load this module onto d.o. So no manual installation/activation is possible. Hiding is still an option, but no requirement.

3) This only gets triggered after installing 'locale'. How could it be executed multiple times?

4) Including Local Translator as a dependency breaks the installation, resulting in multiple notices. I do not understand why....(any suggestions?) Also, LT requires much more guidance for the casual demo user to understand.

5) Somebody told me the other day that users need real text to relate to the system.....

miro_dietiker’s picture

In re...

> 1) This is the only way to trigger the installation and activation of tmgmt_demo on Simplytest.me. If we want a ready-to-use demo system there, we need to make the patch self starting.
Thought you can pass to them to enable tmgmt_demo on install. See link.

> 2) There is no need to ever load this module onto d.o. So no manual installation/activation is possible. Hiding is still an option, but no requirement.
This module also should never be enabled in production, so we don't it to show up in module list.

> 3) This only gets triggered after installing 'locale'. How could it be executed multiple times?
It's hook_module_installed. It gets executed after each module install: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...
If you want to limit it to locale, i would suggest an early exit.

if !(in_array('locale', $modules)) {
  return
}

> 4) Including Local Translator as a dependency breaks the installation, resulting in multiple notices. I do not understand why....(any suggestions?) Also, LT requires much more guidance for the casual demo user to understand.
I see, there are multiple approaches: testing only a simple/reduced setup VS testing extended features / anything possible. With DSB we name this "scenarios" and have different cases to address. With this approach we either would need multiple submodules for each scenario or even choose the install profile approach.

> 5) Somebody told me the other day that users need real text to relate to the system.....
Fully agree that gibberish adds complexity. Is there anything like wikipedia generate? (or should we use wget? is wget even allowed in simplytest.me?!) ;-)

berdir’s picture

1) The problem with that is that it results in a weird dependency tree, the core module shouldn't depend on the demo module that provides content for it. Have you tried a module_enable(array('tmgmt_demo')) in tmgmt_install() ?

2. Yes, we want to add it :). This could for example also be interesting if you set up a development environment to work on TMGMT. That's why it needs to be hidden, so that you can only do it through drush en. Then the only thing the patch would need to do is add the snippet that enables it automatically.

3. Yes, it is wrapped, but there's no guarantee that locale and microsoft translator are installed at the same time, so this is tricky. if the module_enable() works, you could use hook_install() and wouldn't have to worry about modules, you'd just specify what you need.

4. Yep, keys are problematic. If you think the local translator is too hard to grasp, then that's a problem of the local translator and we should fix it :). I don't think it's that bad if there's some initial configuration for the languages etc. Eventually, there could be a few that we could include, some work out of the box (we could provide a drupal translator against our sandbox server) others need configuration. That's imho ok if there's no way around it. At least we shouldn't do it without checking with them.

berdir’s picture

@Miro:
1) No, you can only pass *projects*, not multiple modules within the same project. So it would only work if we set it up as a separate project.

3) As discussed, the check is there but a bit confusing, being able to use hook_install() would be much easier.

cgalli’s picture

3) Using hook_install in tmgmt_demo not only results in notices but completely crashes the system (resulting in everything but tmgmt core enabled...). Will try the path of module_enable combined with hook_install

patrickd’s picture

Please use one of the following .info directives to enable a module on simplytest.me programatically:

recommends[] = some_module
test_dependencies[] = some_module
simplytest_dependencies[] = some_module

I updated the documentation page according to that info.

You can find this and more at the Questions and Answers section of simplytest.me: http://simplytest.me/qa#developers

patrickd’s picture

I just re-read my own documentation and realized that these directives only fetch the specified dependencies and don't install them. (stupid me, sorry!)

But that's (obviously) not very intuitive: change request here: #2116901: Not only fetch, but also enable recommended / demo dependencies

cgalli’s picture

StatusFileSize
new1.76 KB

Initial patch to test simplytest_dependencies[]

Demo module is not yet hidden, so we can turn it on manually on testing site.
Core and Demo must be turned on one at a time.

In simplytest.me, demo should be enabled by the sandbox.

cgalli’s picture

Did not work.

An error occurred while patching the project. says simplytest.me

Any idea?

miro_dietiker’s picture

sidenote cgalli: with drush you can also enable hidden modules.

berdir’s picture

StatusFileSize
new1.7 KB

Re-roll without the dpm() call in there (that can't work as you don't install devel), also fixed windows line endings.

berdir’s picture

StatusFileSize
new1.8 KB

Looks like hook_install() doesn't work somehow, it works if you re-install it manually.

@Miro: Yeah... but you don't have drush on simplytest.me ;)

berdir’s picture

StatusFileSize
new1.69 KB

Another version that doesn't do the install stuff conditional but with hook_install().

berdir’s picture

Yeah, no luck with all of those, re-opened the simplytest.me issue.

cgalli’s picture

The same thing happens in manual install. When enabling/installing Core and Demo at the same time, the hook_install does not seem to be invoked. When enabling them in sequence (Enable core, save, enable demo save), it works.

berdir’s picture

StatusFileSize
new1.79 KB

Ok, found it, we need to manually include locale.inc.

miro_dietiker’s picture

Status: Active » Reviewed & tested by the community

Great work, guys. Works for me as a very basic setup.

However, note that in #2 cgalli already did more like create some basic nodes that reduce clicking to create a first job.
Also translators are no more setup.

Will we need some helper node / block that explains the required/recommended steps?

(all followup?)

berdir’s picture

Status: Reviewed & tested by the community » Needs work

Hm, yes, let's at least re-add some of that. The node body could be used as a place to put some descriptions to get started.

cgalli’s picture

Assigned: Unassigned » cgalli

I will take care of that.

cgalli’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new3.31 KB

- Adapted demo to use the local translator and xliff only.
- Added the demo content back, could not find a reasonable source for dummy content.
- The uninstall hook does not run through, I do not understand why. Please advise.
- The module is not hidden yet for testing purposes.

Status: Needs review » Needs work

The last submitted patch, 24: demo_setup_24.patch, failed testing.

berdir’s picture

This is a new test that went in a while ago and had the same test fail initially, not related to this...

blueminds’s picture

Status: Needs work » Needs review
StatusFileSize
new4.44 KB

debugging broken test

Status: Needs review » Needs work

The last submitted patch, 27: demo_setup_25.patch, failed testing.

blueminds’s picture

Status: Needs work » Needs review
StatusFileSize
new4.11 KB

Problem is in the order of jobs. The test expects the tested job to be in the second position in the list, which is not always true during tests. Rewrote the xpath to search for the expected text and not to rely on the order.

berdir’s picture

StatusFileSize
new4.07 KB
new1.3 KB

Fixed a few bugs, now it actually works.

Adding language skills to user 1 instead of current user, current user is anon if you e.g. install with drush or probably also the simplytest.me script

Uninstall had a typo, note_type_delete() :)

berdir’s picture

Status: Needs review » Needs work

No it doesn't. My user_save() overrides the user password.

cgalli’s picture

Status: Needs work » Needs review
StatusFileSize
new4.13 KB

Changed user_save(), the Login works again.

Add: The patch works correctly with simplytest.me :-)

berdir’s picture

Status: Needs review » Fixed

Awesome.

Committed and pushed, without the snippet that was already committed separately.

This works now just like this: http://simplytest.me/project/tmgmt/7.x-1.x

@cgalli: Can you update the project page/documentation and add a link to that URl so that people can try it out. There used to be a specific demo site link, I assume that still exists.

cgalli’s picture

Assigned: cgalli » Unassigned
Status: Fixed » Needs review
StatusFileSize
new1.33 KB

Adjusted Documentation.

The attached patch fixes a little mistake preventing reinstallation. In addition it adds 2 specific links to the documentation.

If anybody knows how to make those 2 links open in a new tab ('TARGET = _BLANK'), please advise. It is not optimal to start a simplytest.me session just to replace it with the documentation page immediately).

miro_dietiker’s picture

Modifying the target of the link is no core feature. It requires some ugly code... .-)

The documentation links are public. I would not check for "access content" permission. Instead always deliver: TRUE.

I guess long term i would create a separate menu "Documentation" and place it in the design. Thus also remove the "Documentation for" chunks from the link title.
Also in this case it is more easy to add the target for all documentation links in the documentation menu.

Problem: You added a bugfix and a new feature into the same issue. The basic feature of simplytest.me went in with TMGMT. We usually continue in followup issues and separate the different aspects (one bug, one feature).

cgalli’s picture

Status: Needs review » Fixed

Follow up Issue: #2142557: Demo Module cannot be (re)installed for the bug fix

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

miro_dietiker’s picture

Component: Core » Demo / Simplytest.me