This issue is spawned from #1222106: Unify language negotiation APIs, declutter terminology to do standardization in the language bootstrap and language types initialization that is closely related. The proposed changes are as follows:
Previous name | New name | Rationale |
---|---|---|
drupal_language_initialize() | no change | As per suggestions in #1222106: Unify language negotiation APIs, declutter terminology by @plach. |
drupal_language_types() | language_types_get_default() | Establish a language_types_get_* namespace for list getter functions (there are three of them to unify). Avoid overcrowding the drupal_* namespace. |
language_types() | language_types_get_all() | See above. |
language_types_configurable() | language_types_get_configurable() | See above. |
language_initialize() | language_types_initialize() | Initializes language types in fact. Should keep under this 'namespace'. |
language_types_info() | no change | Returns hook_language_types_info() values altered with hook_language_types_info_alter(). |
language_types_disable() | no change | Disables language types. |
language_types_set() | no change | Resets the language types cache list (used by all the language_types_get_*() functions). |
That is all the language_types_*() functions after the patch neatly lined up according to a consistent pattern. Before the patch (if you look at the first column), the function names are spread wide and wild. (The attached patch is untested just to start up this cleanup).
Comment | File | Size | Author |
---|---|---|---|
#49 | language_types-1416392-49.patch | 17.31 KB | Gábor Hojtsy |
#47 | language_types-1416392-46.patch | 17.31 KB | Gábor Hojtsy |
#46 | language_types-1416392-46.patch | 17.31 KB | Gábor Hojtsy |
#40 | language_types-1416392-40.patch | 17.3 KB | plach |
#33 | language_types-1416392-33.patch | 16.66 KB | plach |
Comments
Comment #2
Gábor Hojtsydrupal_language_intiialize() was not renamed at all places. Ha.
Comment #3
Gábor HojtsyTagging as current focus.
Comment #4
Gábor HojtsyTagging for base language system.
Comment #5
aspilicious CreditAttribution: aspilicious commentedChooseS I know that the old docs made the same mistake but as you're writing new ones.
ReturnS
The @see should be in the end with a newline above it.
trailing whitespace
Trailing whitespace party
-25 days to next Drupal core point release.
Comment #5.0
aspilicious CreditAttribution: aspilicious commentedUpdated issue summary.
Comment #6
Gábor Hojtsy@plach: Reverted change suggestions for the bootstrap function based on @plach's comment in #1222106: Unify language negotiation APIs, declutter terminology and in the interest of less dispute :) Updated issue summary.
@aspilicious: made changes you've suggested, thanks!
Also noticed the file name had a typo. Fixed that too.
Comment #8
aspilicious CreditAttribution: aspilicious commentedanother one
You should search for an "remove trailing whitespaces on save" option in your text editor. Makes your life easier ;)
-26 days to next Drupal core point release.
Comment #9
Gábor HojtsyI admit I'm evaluating sublime text 2 now, and did not yet figure out the trailing whitespace issue :) Here is a quick patch update which hopefully fixes all line end whitespace and the test failure as well. I certainly don't want to bother you with whitespace issues :)
Comment #10
Gábor HojtsyTagging for language negotiation too.
Comment #11
aspilicious CreditAttribution: aspilicious commentedhttp://drupal.org/node/1346890 i made this page, you will like it
Comment #11.0
plachUpdated issue summary.
Comment #12
plachDo we want to switch to the scope terminology in this patch? If so I'd go for the singular form:
Anyway:
Associated? I think we normally use the "indexed" or "associative" terms. Also "Base" should be "Based", I guess.
Wrong comment wrapping.
IIRC there should be a blank line before the @param(s).
"given" should be moved one line up.
-28 days to next Drupal core point release.
Comment #13
Gábor HojtsyOk, let's do those then!
Comment #14
rvilarAfter a little mail conversation with Gábor, I'm going to work on the switch scope terminology
Comment #15
plach@rvilar:
Great! Also
LANGUAGE_TYPE_*
constants will need to be updated.Comment #16
sunHm. Where did we discuss "scope"? When I read #12 I had no idea what a scope is and that the proposal was to rename language types to scopes. I'm not sure whether that term is really an improvement over the current, and thus, whether it's worth to break and change the API and what people have learned (aside from the locale/language function name changes). It might be, but hm.
Comment #17
Gábor Hojtsy@sun: I could not find any discussion either (and cannot recall one where scope was decided on either). The closest to that happened in #1156576: Language negotiation is undocumented, but we did not discuss what to rename types to. Just that "types" is not the best name maybe. I don't know if scope or type is better, either case it needs documentation to enlighten the use of the terms in Drupal as neither is a well known term (but rather Drupalisms). Whether it is good to move to a new Drupalism from an old Drupalism, I don't know. The above patch did not get much traction otherwise, so it was logical to try and move to a direction accepted by more reviewers I guess. If you happen to stand on the language_types side, then well, we have a passing patch and we can talk about making that land - and then we can document it in a way that is easily backportable :) I believe it needs some good documentation either way and wanted to get people going on that once we have the types / negotiation APIs cleaned up.
Comment #18
plach@sun:
I proposed this change in #1222106-4: Unify language negotiation APIs, declutter terminology and Gabor seemed to approve it. I spoke with @chx in IRC proposing him the scope terminology and he said something like "everything is better than type". If we want to go the scope way @rvilar is available to write the patch, if not no worries, but the patch in #9 needs work.
Comment #19
sunI guess we can simply move on and discuss the terminology in parallel. May or may not be a simple rename in the final patch in the end, depending on the discussion. We need to change the function names either way.
Comment #20
rvilarI attach a patch with the rename done. Please, review and comment on that.
Comment #21
Gábor Hojtsy@rvilar: have you applied the other changes suggested by @plach?
Comment #22
rvilarYes. I've applied all the suggestions and corrections.
Comment #23
plachNow we have two mostly RTBC patches, let's discuss which one we prefer :)
As I said, if we want to change the type terminology (which might make sense) I'd go for scope, since IMHO it make more clear what the actual meaning is: for instance, I'm thinking of a page where the admin menu and the local tasks have the admin language, the rest of the UI has the site default language and a translated content is being showed. Type fits here as well, but if we want to change it, scope is my favorite alternative.
Maybe what we want is a committer feedback here? I doubt we will get any from @chx.
@rvilar:
Thanks, I had a quick look to the patch and found some comments not wrapping correctly:
Wrong comment wrapping.
Comment #24
Gábor HojtsyMy view on type vs. scope is that either will need to be well documented and will not be immediately understood by people, so I'm neutral on that really. Chatted with @sun a bit in IRC about it and after he pulled out a dictionary to look up the concrete definition of scope, he said he might like scope more, but it might not have been his final word.
Comment #25
sun"scope" might be the best option. But I think we should ideally ask some developers who are unfamiliar with this issue to answer this open question:
(you can replace "Scope" with "Type", "Context", etc)
Comment #26
Tor Arne Thune CreditAttribution: Tor Arne Thune commentedSpeaking as myself when I first encountered the term 'language type' it made absolutely no sense to me. I can only imagine how my understanding would be with the term 'language scope' back when I started out, but now it makes more sense to me than language type. Language scope to me means on what 'areas' the language settings will apply. Language type does not let me imagine what this could mean in the context of Drupal at all. Language context is not bad either, but I feel scope is better, because it probably will not be used elsewhere in Drupal, and therefore be less confounding when encountering other parts of Drupal with similar names.
Comment #27
Gábor HojtsyLet's see if we get any input (not that it would be representative): https://twitter.com/gaborhojtsy/status/164326586336821249
Comment #28
Gábor HojtsyAll feedback I got was:
- Dave Reid: "Literally have no idea what functionality a language scope API would be responsible for or do."
- Neclimdul: "Oh no. Language Scope API doesn't mean anything to me but I don't do a lot of internationalization development. "
- Crell: "It would allow you to translate mouthwash into different languages."
Which looks like it confirms that (a) people don't engage with D8MI much (b) it will need a lot more docs either way.
Comment #29
plachLOL
I think we need Dries' feedback. As Tor Arne Thune was pointing out in #26 probably for someone needing to deal with ML aspects scope would be a bit more accessible than type, but docs will be a key factor anyway. We need to understand if the time spent on polishing the terminology is worth this gain or whether we should leave it as is.
Comment #30
Gábor HojtsyI'm still not sure it is worth the gain (especially given the very limited scope of this API if you forgive the pun :) as we need to document it anyways.
Comment #31
plachNo problem at all with that. I just want to have a link to show to anyone will say the language type does not mean anything ;)
Comment #32
Kristen PolI'll throw in my 2 cents... I prefer "type" rather than "scope" only because it is a more familiar term (in general) and I don't normally see "scope" used in programming. I definitely do have a strong aversion to using "context" only because of the Context module and CTools context and other uses of the word within Drupal.
[update] After seeing the
drupal_language_types()
function, I understand why "scope" was proposed. It does seem more "appropriate" though I still like the sound of "type" better for some intangible reason.What about language group? Or, category?
Kristen
Comment #33
plachRerolled #9 with the cosmetic fixes proposed in #12 applied. The patch "logic" is unchanged.
I'd be glad If @Dries could let us know his opinion about whether we need to change the "language type" terminology (see #16 and following). IMO his feedback has a double value here: as the project lead's and as the one of a core developer non deeply involved in multilingual stuff.
If we decide to keep "type" I'd say this is ready to go in.
Comment #35
plach#33: language_types-1416392-33.patch queued for re-testing.
Comment #37
plachIt seems some new tests got in meanwhile...
Comment #38
Gábor Hojtsy@plach: Keeping type seems like the safest choice since we did not get much support to change it to something else either. I think strong docs will help there a lot. Also, we should not be obsessed with this qustion a lot, we have a lot more important stuff to do. Can you work on fixing the tests?
Comment #39
plachI'l have a look to tests tonight if someone does not beat me to it before
(feel free ;)
Comment #40
plachTests were failing due to #1331370: [Upgrade path broken] Stored include paths need to be updated to /core before running the upgrade path that introduced a new call to
language_types()
in the upgrade preparation phase.Comment #41
Gábor HojtsyI think based on the feedback we got, it looks like we are better off committing this simple cleanup now and see how the context system progresses later, when this code will be revisited again. We can move on in the meantime to work with the rest of the negotiation code and move it around to language module, so if this is committed, our work can roll on.
The patch only contains phpdoc fixes and standarized function names as documented above in the issue summary, and I think its a straightforward and logical DX improvement to get in. We'll proceed documenting the whole negotiation system when we are over cleaning up the rest of the negotiation components.
Comment #42
Kristen PolLooks good... thanks @plach!
Kristen
Comment #43
Dries CreditAttribution: Dries commentedAssigning this to myself so I can comment on the terminology (as requested above). I think I should be able to do this tomorrow.
Comment #44
Gábor Hojtsy@Dries, this has been a week ago. Can you help move this forward?
Comment #45
plach#40: language_types-1416392-40.patch queued for re-testing.
Comment #46
Gábor HojtsyPatch did not apply anymore due to changes in #1430986: Clean up naming for language negotiation configuration functions/paths. Only a single hunk in locale.admin.inc was not applying due to changes very close to where it should change to language_types_get_configurable(). Rerolled. Should be back to RTBC IMHO once it proves it passes tests again.
Comment #47
Gábor HojtsyTestbot got stuck. Re-upload patch to get it rested since it cannot be re-tested via the UI in this state. Same patch as the previous comment, no change, just re-trigging testbot.
Comment #48
Gábor HojtsyBack to RTBC as per the above.
Comment #49
Gábor HojtsyPatch applied with offsets. Rerolling just to make sure it applies 100% clean. No changes (same byte size in fact :).
Comment #50
Dries CreditAttribution: Dries commentedI'm not sure $scope is better than $type. We can discuss that in another issue. In the mean time, this patch looks like great progress. Committed to 8.x. Sorry for holding this one up.
Comment #51
Gábor HojtsyAdded change notice at http://drupal.org/node/1450154. Removing outdated tag.
Comment #52
Gábor HojtsyThis is about to culminate in #1468930: Clean up and move the code for the negotiation functionality from locale module to language module, see you there!
Comment #53.0
(not verified) CreditAttribution: commentedUpdated issue summary.