This fixes problems where ggplot2 is an import for other packages. In those cases, there is no package:ggplot2 envrionment, since ggplot2 is not attached.
Previously, when find_global() didn't find the variable in the global environment, it checked in the ggplot2 namespace with getNamespace(). This can cause problems because the function loads the installed package if not already loaded. During development, ggplot2 is typically loaded with load_all(), and loading the installed ggplot2 package can cause conflicts.
Previously, it used trans_type to find the appropriate transformation. Now it uses scale_type to find the appropriate scale -- and the scale definitions contain information about which trans to use ("date", "time", "identity").