Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pillarsdotnet’s picture

Status: Active » Needs review
FileSize
2.1 KB

The following patch adds filter support to the 7.x-3.x branch.

pillarsdotnet’s picture

Title: Add filter support » Add support for a transliteration text format filter.
Priority: Normal » Major

Bump and title change. The 7.x version of HTML Mail can use this feature if it is available.

pillarsdotnet’s picture

Another bump and slightly better filter settings form.

smk-ka’s picture

This looks like a nice addition, still need some time to test. Could you please change all function names to use transliteration_filter_*() instead of _filter_transliteration_*()?

smk-ka’s picture

Status: Needs review » Needs work
pillarsdotnet’s picture

Sure. Patches for D6 and D7 attached. I also have working code here..

pillarsdotnet’s picture

Status: Needs work » Needs review
pillarsdotnet’s picture

Trying again on that D7 patch; ignore previous.

As an aside, please note that the original function names were chosen to comply with Drupal guidelines. See filter_example.module.

pillarsdotnet’s picture

Reconsidering; this really ought to be a sub-module so it shows up in the "Input filter" section of the module listing.

pillarsdotnet’s picture

pillarsdotnet’s picture

pillarsdotnet’s picture

Status: Needs review » Closed (won't fix)

Looks like this isn't going anywhere.

pillarsdotnet’s picture

Status: Closed (won't fix) » Needs review
amateescu’s picture

Priority: Major » Normal
Status: Needs review » Needs work
 filter_transliteration/README.html                 |    3 +
 filter_transliteration/README.markdown             |    9 +++
 filter_transliteration/README.txt                  |   13 ++++

Do we really need three README files?

+++ b/filter_transliteration/README.txt
@@ -0,0 +1,13 @@
+                           [1]Filter transliteration
+
+   Provides a [2]text format input filter for the [3]Transliteration
+   module.
+
+   Also available as a [4]patch.
+
+References
+
+   1. http://drupal.org/project/filter_transliteration

References a different project.

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,61 @@
+      'process callback' => '_filter_transliteration_process',
+      'settings callback' => '_filter_transliteration_settings',
+      'tips callback' => 'filter_transliteration_tips',

Inconsistent naming for filter_transliteration_tips.

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,61 @@
+ * Implements hook_filter_FILTER_process().
+ * @see filter_transliteration_filter_info()
...
+ * Implements hook_filter_FILTER_settings().
+ * @see filter_transliteration_filter_info()
...
+ * Implements hook_filter_FILTER_tips().
+ * @see filter_transliteration_filter_info()

Needs a blank line before @see.

pillarsdotnet’s picture

(/me does the happydance!)

Umm.. Sorry about the three README's. That's my personal convention; I write the original in Markdown and generate both HTML and TXT from that.

Let me know which version you prefer and I'll remove the other two.

Will fix the rest shortly.

amateescu’s picture

The Drupal standard is to include a README.txt, so let's go with that one :)

pillarsdotnet’s picture

Status: Needs work » Needs review
FileSize
3.25 KB
3.05 KB

On further reflection, there really isn't any useful information in the README.txt that isn't also in the .info file, so I just deleted it.

Fixed the rest and re-rolled against 6.x-3.x and 7.x-3.x.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me now. I think those @see's are not really needed anyway because they're referencing a function in the same file (and it's a really small file :)). Anyway, don't re-roll just for this change, they can be easily handled at commit-time.

sun’s picture

Status: Reviewed & tested by the community » Needs review
--- /dev/null
+++ b/filter_transliteration/filter_transliteration.info

Hm. There's a module namespace issue here.

Normally, this should be transliteration_filter, but of course, that leads to rather wonky function names like transliteration_filter_filter_info()...

Is there actually any reason for making this a separate sub-module?

Looks like these 50 lines could as well live in the .module?

sun’s picture

Status: Needs review » Needs work
+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,64 @@
+ *
+ * @see http://drupal.org/project/transliteration

Can be removed.

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,64 @@
+      'title' => t('Transliteration'),
+      'description' => t('Convert non-latin text to US-ASCII equivalents.'),

The description is the title.

Leave the description empty, if there's nothing to describe.

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,64 @@
+      'default settings' => array('unknown' => '?'),
...
+  $filter->settings += $defaults;
...
+    'unknown' => array(
...
+      '#title' => t('Unknown'),
...
+      '#default_value' => $filter->settings['unknown'],

Uhm, this needs work. ;)

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,64 @@
+ *
+ * @see filter_transliteration_filter_info()
...
+ *
+ * @see filter_transliteration_filter_info()
...
+ *
+ * @see filter_transliteration_filter_info()

Can be removed.

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,64 @@
+      '#field_prefix' => t('Replace non-ASCII characters with') . ' ',
+      '#field_suffix' => ' ' . t('if there is no suitable ASCII equivalent.'),

The additional spaces before and after the field can be removed.

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,64 @@
+      '#maxlength' => 5,

Why 5?

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,64 @@
+      '#attributes' => array('style' => 'width: 1em'),

Should be removed.

+++ b/filter_transliteration/filter_transliteration.module
@@ -0,0 +1,64 @@
+  return t('Non-latin text will be converted to US-ASCII equivalents.');

I don't think that ordinary end-users are going to understand what this means.

pillarsdotnet’s picture

Re-rolled according to suggestions.

pillarsdotnet’s picture

Status: Needs work » Needs review
amateescu’s picture

Status: Needs review » Needs work

@pillarsdotnet, you forgot about this part:

Is there actually any reason for making this a separate sub-module?

Looks like these 50 lines could as well live in the .module?

Let's move the filter to transliteration.module :)

pillarsdotnet’s picture

The reason for making this a separate sub-module is so that it shows up with the rest of the filter modules in the module listing.

amateescu’s picture

Pasting @sun's comments from IRC:

  1. don't think we want a separate module?
  2. you misunderstood the request to replace title with description, the current filter label (visible in admin UI) is nonsense for humans
  3. the filter setting key is still not self-descriptive
  4. don't understand the += $defaults (not needed in D7)
  5. #title should be visible
  6. #field_prefix/suffix most likely look strange
  7. filter tip sounds wonky
pillarsdotnet’s picture

Status: Needs work » Needs review
FileSize
2.86 KB
2.93 KB
  1. See #24 above.
  2. Changed.
  3. Changed.
  4. Changed.
  5. Changed.
  6. Deleted.
  7. Changed.

And if you think all of the below sound equally "wonky", then please suggest an alternate wording; I'm out of ideas:

  • US-ASCII
  • 7-bit ASCII
  • Characters from '!' to '~' inclusive

Or better yet, close the issue as "won't fix" and I will continue to maintain the separate Filter transliteration module.

Freso’s picture

I actually think "Non-latin text will be converted to US-ASCII equivalents." works fine, perhaps just some examples need embedding? (E.g., "Non-latin text (e.g., å, ö, 漢) ... US-ASCII equivalents (a, o, ?)." I don't think we should remove the technical terms just because they're technical. People can either use the examples to guide them or look up the terms they're unsure of.

Or better yet, close the issue as "won't fix" and I will continue to maintain the separate Filter transliteration module.

Whether the code is living in Transliteration or in your own module, the code (incl. wording) comments are just as valid.

amateescu’s picture

Status: Needs review » Fixed

Cleaned-up a bit the patches from #26 and committed to 6.x-3.x and 7.x-3.x. I decided to include this functionality in the main module though.

Thanks for all the work on this, Bob :)

http://drupalcode.org/project/transliteration.git/commit/ee9b55e
http://drupalcode.org/project/transliteration.git/commit/6a53653

Status: Fixed » Closed (fixed)

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