About
This module extends the language object and the Create and Edit forms for languages by a new field.
With this new field, it is possible to define a ISO 3166-1 alpha-3 or UN M.49 Regioncode for your languages (e.g. "US" or "DE".)
With this module you can use IETF Language Tags in other modules or themes.
Usage Example
I needed this feature for a multilingual website I'm working on currently. With this module I can embed the Facebook JS API always in the correct language.
Project Page:
http://drupal.org/sandbox/michaelpetri/1965464
Git Repository:
git clone --branch 7.x-1.0 git.drupal.org:sandbox/michaelpetri/1965464.git language_region
Last but not least
I know this Project isn't really demanding and it has less than the requested 120 lines of code. I started this Project to get more familiar with git and how to contribute modules to drupal because i've some other great modules which I want to share with the community in the next weeks.
Comments
Comment #1
PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
bechtold commentedHi michaelpetri,
especially because you want to learn git and stuff, first thing todo is to remove the master branch and set the default branch to 7.x-1.x:
In your git link above you can remove your username as well :-)
Your project page tells us not much and you are missing a README.txt.
Please add info about your module to both. Kind of in the way you have written in this application.
Your branch is 7.x-1.0 but as i understand the git workflow, your branch should be 7.x-1.x and 7.x-1.0 should only be a release tag.
Coder and pareview are throwing too many warnings at the moment.
I'm not sure if it's a good idea to make the language region code required, especially because it's not prefilled.
Maybe you could set locale as dependency to your .info file, as your module doesn't make much sense without languages :-)
You save the extra info into an extra table, isn't it possible to save that info directly into the languages table?
I'm not sure, if it's possible to influence other modules tables, but if, I think it would be the way to go.
Also very nice would be a file like the iso.inc prepared with codes for the default languages. Then the field could be prefilled.
If that file included different codes like ISO 3166-1 alpha-3 or UN M.49 you could give the user the option to just use one,
so he/she doesn't have to look them up.
But all together I like the idea of your module. It's sometimes helpful to differentiate btw. gb and us english or btw. swiss and german german.
One thing I'm not sure about though, the standard language code is an iso code already, isn't it?
Cheers
bechtold
Comment #3
bechtold commentedsorry, double post :-(
Comment #4
michaelpetri commentedHi bechtold,
first of all thanks for your kind feedback and telling me about Coder and pareview.
I changed the source code to fit the drupal coding standards.
Pareview throws 0 Errors and 5 Warnings, some line exceeds and comment stuff but i think
now the branch looks really good.
Here a list of thinks i have changed:
To your ideas:
Best regards
Michael
Comment #5
markpavlitski commentedYour module is looking really good!
I would agree that providing your own table in this case is a better approach to altering tables provided by other modules.
I just have a few suggestions:
Firstly, your git link in the project description is pointing to the old 7.x-1.0 branch. I would suggest changing it to the public http link too:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/michaelpetri/1965464.git language_regionlanguage_region.module:92: You should use array() as the default value for $cache, i.e.
language_region.module:102: You should add an else statement here and set
$cache[$langcode]to FALSE (or you can set it to NULL and change !isset() to !array_key_exists() on line 94). Otherwise the db_select() call can happen multiple times if the entry doesn't exist in the table.You have a few comment and spacing issues too which are worth correcting. Take a look at the coding standards around indenting and the documentation standards and the automated test output for your module:
http://ventral.org/pareview/httpgitdrupalorgsandboxmichaelpetri1965464git
Comment #6
michaelpetri commentedThanks for your kind feedback. I will start to fix everything later this week.
Best regards
Michael
Comment #7
PA robot commentedClosing due to lack of activity. Feel free to reopen if you are still working on this application.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #7.0
PA robot commentedUpdated Project description.
Removes username from git link.