The Simple I18n module implements a trivial patter matching markup to enclose your localizable strings. Anything that is sent to the user using a theme page template (and is not published in the /admin section) gets parsed by this module, so when the markup is found it is automatically filtered and outputted in the current language.

Uses

For localizing menu links, terms, views, field labels, a.o. Use the simple markup:
[[@ Primary language string; Other language; Third one; ... ]]

Translated string should be listed in the same order as site languages are in Regional and language configuration page.

Why was it created?

The main difference form the existing I18n suite (that I tried to use and didn't work out as expected for menus, taxonomy and views):

  • this module is trivial to setup and covers all the needs left over by the content translation module for small sites.
  • it uses a simple to understand (and easy to type) syntax, that should be safe for usage in output ( a "[[@ ... ; ... ; ... ]]" construction is, at least, extremely rare IMHO for JS, CSS, HTML, XML or human/machine-readable content. I consider allowing configuration of the pattern, if required by the comunity.

Compatibility

It's for Drupal 7.x (but can easily be ported to 6.x).

git clone http://git.drupal.org/sandbox/z7/1347340.git simple_i18n

Plans for future

I plan to enable this one on several production sites this week.

I also have in plan to write a simple module that would make use of HTML5 upload fields in file/image field type widgets (for browser supporting it). It would hook in the field API and add the required number of fields, depending on what was submitted by the user.

I had some other code contributions, stated in comments, but I felt there was no need to release them as modules.

Comments

chakrapani’s picture

Status: Needs review » Needs work

Review of the 7.x-1.x branch:

  • Run coder to check your style, some issues were found (please check the Drupal coding standards):
    Severity minor, Drupal Commenting Standards, Internationalization, Drupal Security Checks, Drupal SQL Standards, Drupal Coding Standards
    
    sites/all/modules/pareview_temp/test_candidate/simple_i18n.module:
     +2: [minor] Commits to the Git repository do not require the CVS $Id$ keyword in each file.
     +6: [minor] There should be no trailing spaces
     +8: [minor] There should be no trailing spaces
     +14: [minor] Missing period
     +32: [minor] Missing period
     +46: [minor] There should be no trailing spaces
    
    Status Messages:
     Coder found 1 projects, 1 files, 6 minor warnings, 0 warnings were flagged to be ignored
    
  • README.txt is missing, see the guidelines for in-project documentation.
  • Comments: there should be a space after "//", see http://drupal.org/node/1354#inline
    simple_i18n.module:38://function simple_i18n_theme_registry_alter($theme_registry) {
    
  • Comments should be on a separate line before the code line, see http://drupal.org/node/1354#inline
    50:    return $content; // do not parse admin pages
    
  • ./simple_i18n.module: The description on the line after the @param/@return documentation is either missing or not formatted correctly. See http://drupal.org/node/1354#functions
    47- */
    
  • Remove all old CVS $Id tags, they are not needed anymore.
    simple_i18n.info:1:; $Id$
    simple_i18n.module:2:// $Id$
    
  • All text files should end in a single newline (\n). See http://drupal.org/node/318#indenting
    ./simple_i18n.info ./simple_i18n.module
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

z7’s picture

Status: Needs work » Needs review

Fixed.

z7’s picture

Issue summary: View changes

Typo

raynimmo’s picture

Status: Needs review » Needs work

Automated review
Please keep in mind that this is primarily a high level check that does not replace but eases the review process. There is no guarantee that no other issues could show up in a more in-depth manual follow-up review.

Drupal Code Sniffer has found some code style issues (please check the Drupal coding standards):

FILE: ...9-themedev\sites\default\modules\reviews\simple_i18n\simple_i18n.module
--------------------------------------------------------------------------------
FOUND 16 ERROR(S) AND 2 WARNING(S) AFFECTING 14 LINE(S)
--------------------------------------------------------------------------------
  1 | ERROR   | End of line character is invalid; expected "\n" but found
    |         | "\r\n"
  9 | ERROR   | Whitespace found at end of line
 14 | WARNING | Format should be * Implements hook_foo().
 39 | WARNING | Format should be * Implements hook_foo().
 50 | ERROR   | Inline comments must start with a capital letter
 50 | ERROR   | Inline comments must end in  full-stops, exclamation marks, or
    |         | question marks
 59 | ERROR   | Inline comments must start with a capital letter
 59 | ERROR   | There must be no blank line following an inline comment
 61 | ERROR   | Inline comments must start with a capital letter
 65 | ERROR   | Inline comments must start with a capital letter
 70 | ERROR   | Inline comments must start with a capital letter
 70 | ERROR   | Inline comments must end in  full-stops, exclamation marks, or
    |         | question marks
 73 | ERROR   | Variable "oldContent" is camel caps format. do not use mixed
    |         | case (camelCase), use lower case and _
 75 | ERROR   | Variable "oldContent" is camel caps format. do not use mixed
    |         | case (camelCase), use lower case and _
 77 | ERROR   | Whitespace found at end of line
 78 | ERROR   | Inline comments must start with a capital letter
 78 | ERROR   | Inline comments must end in  full-stops, exclamation marks, or
    |         | question marks
 84 | ERROR   | Inline comments must start with a capital letter
--------------------------------------------------------------------------------

These are fairly minor documentation formatting points really other than the camel-case errors.

Make sure to set your status back to 'needs review' once you have addressed the issues highlighted above.

Good luck with the rest of your review.

z7’s picture

Raynimmo, thanks for your time.
I fixed the things that Drupal Code Sniffer found. What would be next for me to do to pass the application to the Community review phase?

z7’s picture

Status: Needs work » Needs review
patrickd’s picture

Status: Needs review » Needs work

Review of the 7.x-1.x branch:

  • Drupal Code Sniffer has found some code style issues (please check the Drupal coding standards):
    
    FILE: ...eview/sites/all/modules/pareview_temp/test_candidate/simple_i18n.module
    --------------------------------------------------------------------------------
    FOUND 15 ERROR(S) AND 2 WARNING(S) AFFECTING 13 LINE(S)
    --------------------------------------------------------------------------------
      9 | ERROR   | Whitespace found at end of line
     14 | WARNING | Format should be * Implements hook_foo().
     39 | WARNING | Format should be * Implements hook_foo().
     50 | ERROR   | Inline comments must start with a capital letter
     50 | ERROR   | Inline comments must end in  full-stops, exclamation marks, or
        |         | question marks
     59 | ERROR   | Inline comments must start with a capital letter
     59 | ERROR   | There must be no blank line following an inline comment
     61 | ERROR   | Inline comments must start with a capital letter
     65 | ERROR   | Inline comments must start with a capital letter
     70 | ERROR   | Inline comments must start with a capital letter
     70 | ERROR   | Inline comments must end in  full-stops, exclamation marks, or
        |         | question marks
     73 | ERROR   | Variable "oldContent" is camel caps format. do not use mixed
        |         | case (camelCase), use lower case and _
     75 | ERROR   | Variable "oldContent" is camel caps format. do not use mixed
        |         | case (camelCase), use lower case and _
     77 | ERROR   | Whitespace found at end of line
     78 | ERROR   | Inline comments must start with a capital letter
     78 | ERROR   | Inline comments must end in  full-stops, exclamation marks, or
        |         | question marks
     84 | ERROR   | Inline comments must start with a capital letter
    --------------------------------------------------------------------------------
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

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

z7’s picture

Status: Needs work » Needs review

Sorry, it didn't push the modification last time. Now it's ok.

z7’s picture

Anyone willing to give a review?

z7’s picture

The project was presented during the first OpenSource.md boot-camp and a team of 6 contributors was formed to evolve it into a fully featured I18n project.

The basic direction is to keep the token system as storage solution, but improve UI by using jQuery.
Until the stable (2.0) release, the following things are planned:

  • jQuery powered token parsing for admin use cases, for example when listing menu items. Will show translations as tool-tips for localized items.
  • jQuery powered widgets that will transparently integrate in standard text inputs (titles, site options, taxonomy terms and field values). Will offer user separated fields for each language, that will automatically popup on focus and disappear on blur, allowing intuitive translation, while not polluting the form or requiring extra clicks
  • Improve the module to properly handle search indexing and previews.
  • Update documentation to reflect the changes and future plans.
misc’s picture

Status: Needs review » Needs work

Hi,

You still have some small coding standards issues:

ILE: ...eview/sites/all/modules/pareview_temp/test_candidate/simple_i18n.module
--------------------------------------------------------------------------------
FOUND 17 ERROR(S) AND 2 WARNING(S) AFFECTING 14 LINE(S)
--------------------------------------------------------------------------------
9 | ERROR | Whitespace found at end of line
14 | WARNING | Format should be "* Implements hook_foo()." or "Implements
| | hook_foo_BAR_ID_bar() for xyz_bar."
39 | WARNING | Format should be "* Implements hook_foo()." or "Implements
| | hook_foo_BAR_ID_bar() for xyz_bar."
50 | ERROR | Inline comments must start with a capital letter
50 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
54 | ERROR | Inline comments must start with a capital letter
54 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
63 | ERROR | Inline comments must start with a capital letter
63 | ERROR | There must be no blank line following an inline comment
65 | ERROR | Inline comments must start with a capital letter
69 | ERROR | Inline comments must start with a capital letter
74 | ERROR | Inline comments must start with a capital letter
74 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
77 | ERROR | Variable "oldContent" is camel caps format. do not use mixed
| | case (camelCase), use lower case and _
79 | ERROR | Variable "oldContent" is camel caps format. do not use mixed
| | case (camelCase), use lower case and _
81 | ERROR | Whitespace found at end of line
82 | ERROR | Inline comments must start with a capital letter
82 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
88 | ERROR | Inline comments must start with a capital letter
klausi’s picture

Status: Needs work » Needs review

Please do not switch issues to "needs work" without giving a manual review.

Get a review bonus and we will come back to your application sooner.

misc’s picture

Status: Needs review » Needs work

I installed the module, but I do not really know how to test it after that. Maybe it is just me... Could you add some more information about how to use it?

misc’s picture

z7’s picture

Status: Needs work » Needs review

OK. I'll make a guide or something to give a clear view on some use-cases (with screenshots).

misc’s picture

How did it go? Did you get the time to do a guide?

misc’s picture

Issue summary: View changes

Language improvement

chi’s picture

Status: Needs review » Needs work

I couldn't clone project:
warning: remote HEAD refers to nonexistent ref, unable to checkout.
Please, check your HEAD refers.

mitchell’s picture

Status: Needs work » Postponed (maintainer needs more info)

This is an interesting addition to the i18n ecosystem. I'd like to see it in action!

To ease review, #14 would be a big help or posting some type of configuration export would be great too.

I'll set it as waiting to hear back from you.

mitchell’s picture

I'll set it as waiting to hear back from you... because the code reviews don't show anything major.

Thanks!

klausi’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

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

klausi’s picture

Issue summary: View changes

Fix broken git link