This is a small and efficent module that allows change l10n source strings.
If you have typed incorrect localization source strings wrapped in a function "Drupal.t" or "t()", but all translations are already done. Now you can change l10n source strings in code and then on the page admin/build/translate/search and all translations are still binded. Module just adds one "l10n source" field, if it will be changed, then original source will be replaced.

Here is link
Here is git link git.drupal.org:sandbox/cainrus/1435284.git

Drupal 6 module

Comments

eugene.ilyin’s picture

Hello. I spent a Review of your module.
ventral.org/pareview is not work now and I did it manualy.

  • ln10n_source_changer.info: empty comment, so remove that line.
  • Remove "version" from the info file, it will be added by drupal.org packaging automatically.
  • Please add comments to your functions.
  • @file is missing in l10n_source_changer.module
  • drupal_set_message("Original source string with id #$lid was changed to '$newOriginal'."): this is user provided text, so you need to sanitize it to avoid XSS attacks. Please read the documentation about handling text in a secure fashion: http://drupal.org/node/28984
  • '#weight' => 0 - it's default value.
  • drupal_set_message - all user facing text should run through t() for translation.
eugene.ilyin’s picture

Status: Needs review » Needs work

Sorry. I forgot set status to need work.

cainrus’s picture

Status: Needs work » Needs review

Thank you for review, Eugene.
Your notes are extremely important to me. I fixed module.

Robertas’s picture

Status: Needs review » Needs work

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.

Review of the master branch:

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.

</code></p><code>
<p>FILE: ...al-7-pareview/sites/all/modules/pareview_temp/test_candidate/README.txt<br>
--------------------------------------------------------------------------------<br>
FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)<br>
--------------------------------------------------------------------------------<br>
 14 | WARNING | Line exceeds 80 characters; contains 81 characters<br>
--------------------------------------------------------------------------------</p>
<p>FILE: ...sites/all/modules/pareview_temp/test_candidate/l10n_source_changer.info<br>
--------------------------------------------------------------------------------<br>
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)<br>
--------------------------------------------------------------------------------<br>
 5 | ERROR | Files must end in a single new line character<br>
--------------------------------------------------------------------------------</p>

FILE: ...tes/all/modules/pareview_temp/test_candidate/l10n_source_changer.module<br>
--------------------------------------------------------------------------------<br>
FOUND 50 ERROR(S) AND 2 WARNING(S) AFFECTING 27 LINE(S)<br>
--------------------------------------------------------------------------------<br>
 10 | ERROR   | Missing parameter type at position 1<br>
 10 | ERROR   | Parameter comment must be on the next line at position 1<br>
 11 | ERROR   | Missing parameter type at position 2<br>
 11 | ERROR   | Parameter comment must be on the next line at position 2<br>
 12 | ERROR   | Missing parameter type at position 3<br>
 12 | ERROR   | Parameter comment must be on the next line at position 3<br>
 13 | ERROR   | Expected 1 space(s) before asterisk; 2 found<br>
 15 | ERROR   | Inline control structures are not allowed<br>
 16 | ERROR   | Spaces must be used to indent lines; tabs are not allowed<br>
 16 | ERROR   | Line indented incorrectly; expected at least 2 spaces, found 1<br>
 16 | ERROR   | Inline comments must start with a capital letter<br>
 16 | ERROR   | Inline comments must end in  full-stops, exclamation marks, or<br>
    |         | question marks<br>
 21 | WARNING | A comma should follow the last multiline array item. Found: 3<br>
 23 | ERROR   | Whitespace found at end of line<br>
 28 | WARNING | Line exceeds 80 characters; contains 87 characters<br>
 30 | ERROR   | There must be an empty line before the parameter block<br>
 30 | ERROR   | Missing parameter type at position 1<br>
 30 | ERROR   | Parameter comment must be on the next line at position 1<br>
 31 | ERROR   | Last parameter comment requires a blank newline after it<br>
 31 | ERROR   | Missing parameter type at position 2<br>
 31 | ERROR   | Parameter comment must be on the next line at position 2<br>
 32 | ERROR   | Missing comment for @return statement<br>
 35 | ERROR   | Variable "newSource" is camel caps format. do not use mixed<br>
    |         | case (camelCase), use lower case and _<br>
 36 | ERROR   | Variable "originalSource" is camel caps format. do not use<br>
    |         | mixed case (camelCase), use lower case and _<br>
 37 | ERROR   | Inline control structures are not allowed<br>
 37 | ERROR   | Variable "newSource" is camel caps format. do not use mixed<br>
    |         | case (camelCase), use lower case and _<br>
 37 | ERROR   | Variable "newSource" is camel caps format. do not use mixed<br>
    |         | case (camelCase), use lower case and _<br>
 37 | ERROR   | Variable "originalSource" is camel caps format. do not use<br>
    |         | mixed case (camelCase), use lower case and _<br>
 38 | ERROR   | A cast statement must be followed by a single space<br>
 39 | ERROR   | Whitespace found at end of line<br>
 41 | ERROR   | Line indented incorrectly; expected 2 spaces, found 4<br>
 42 | ERROR   | Spaces must be used to indent lines; tabs are not allowed<br>
 42 | ERROR   | Line indented incorrectly; expected at least 4 spaces, found 2<br>
 42 | ERROR   | Variable "newSource" is camel caps format. do not use mixed<br>
    |         | case (camelCase), use lower case and _<br>
 44 | ERROR   | Inline control structures are not allowed<br>
 44 | ERROR   | else must start on a new line<br>
 44 | ERROR   | Whitespace found at end of line<br>
 50 | ERROR   | There must be an empty line before the parameter block<br>
 50 | ERROR   | Missing parameter type at position 1<br>
 50 | ERROR   | Parameter comment must be on the next line at position 1<br>
 51 | ERROR   | Last parameter comment requires a blank newline after it<br>
 51 | ERROR   | Missing parameter type at position 2<br>
 51 | ERROR   | Parameter comment must be on the next line at position 2<br>
 52 | ERROR   | Missing comment for @return statement<br>
 55 | ERROR   | Line indented incorrectly; expected 2 spaces, found 4<br>
 56 | ERROR   | Spaces must be used to indent lines; tabs are not allowed<br>
 56 | ERROR   | Line indented incorrectly; expected at least 4 spaces, found 2<br>
 57 | ERROR   | Spaces must be used to indent lines; tabs are not allowed<br>
 57 | ERROR   | Line indented incorrectly; expected at least 4 spaces, found 2<br>
 57 | ERROR   | Space after opening parenthesis of function call prohibited<br>
 57 | ERROR   | Space before closing parenthesis of function call prohibited<br>
 59 | ERROR   | Files must end in a single new line character<br>
--------------------------------------------------------------------------------<br>

Source: http://ventral.org/pareview - PAReview.sh online service



Manual review:
l10n_source_changer.module:4
* Allows administrators to change l10n source strigns
You may want to fix spelling of "strigns".

cainrus’s picture

Priority: Normal » Critical
Status: Needs work » Needs review

Hello, Robertas.
Thank you for your review. I've just completed the task.

chertzog’s picture

On line 49 of you module file, you have:

$result = db_query("UPDATE locales_source SET source = '$new_source' WHERE lid = $lid");

You are passing variables directly into your query, you should be using placeholders, something like:

$result = db_query("UPDATE locales_source SET source = %s WHERE lid = %d", $new_source, $lid);

for more info check db_query()

Also I'm afraid that this project is too short to approve you as git vetted user. We are currently discussing how much code we need, but everything with less than 120 lines of code or less than 5 functions cannot be seriously reviewed. However, we can promote this single project manually to a full project. (adding tag)
Consider trying it again with another *little* more complex module, or - if possible - try to add more functionality to this module, so there's more to review.

klausi’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

Sorry for the delay, but you have not listed any reviews of other project applications in your issue summary as strongly recommended here: http://drupal.org/node/1011698

manual review:

  1. Remove the "6.x" git branch to avoid confusion.
  2. l10n_source_changer_form_alter(): wrong doc block, see http://drupal.org/node/1354#hookimpl
  3. l10n_source_changer_form_alter(): better use hook_form_FORM_ID_alter() if you are only targeting one specific form.
  4. "$new_source = check_plain($form_state['values']['original_changeto']);": "When handling data, the golden rule is to store exactly what the user typed. When a user edits a post they created earlier, the form should contain the same things as it did when they first submitted it. This means that conversions are performed when content is output, not when saved to the database." See http://drupal.org/node/28984
  5. l10n_source_changer_form_save(): you should use db_update().
  6. "t("Original source string with id #!lid was changed to '!new_source'.", array('!lid' => $lid, '!new_source' => $new_source));": you should use placeholders with "@" for automatic sanitization.
cainrus’s picture

Hello, chertzog.
I have been fixed placeholders issue #1435294-6: l10n source changer
I understand that there are limitations with module size.
This module really helped me when i got wide multilanguage drupal multisite network where custom themes and custom modules contained few different languages hardcoded and already fully translated(about 15 languages). I have changed all translation sources to english language with l10n source changer module. I belive, these module can help someone else too.

Hello, klausi.
I fixed the following issue #1435294-7: l10n source changer items: 1, 2, 3, 4 and 6.
I can't do anything with list item number five, there is no db_update() in Drupal 6.
Thank you for manual review!

Do you have any ideas which i can use for that module?

klausi’s picture

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

Closing due to lack of activity. Feel free to reopen if you are still working on this application.