Jump to content

ZAP

Members
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ZAP's Achievements

Newbie

Newbie (2/6)

3

Reputation

  1. Yes! That was it. I somehow had a copy of the module in both wire/modules/ and also site/modules/. I also had a permissions issue (I couldn't delete the extra one until I changed its permissions), but I think that the issue was just that it was in there twice. Maybe the core should check for that when refreshing for new modules? It's kind of a dumb thing to do, and I shouldn't expect PW to keep me from doing dumb things. Can I say how awesome it is that two people investigated this issue for me just since I posted last night? I'm accustomed to forums where replies can take quite a while and may not be all that helpful. I appreciate the energy and solidarity! I'll look for some posts that I may be able to help with as soon as I get done with my day job today.
  2. I don't think of myself as OCD, but I sure do love me some minified HTML! I used this module on a recent project and it was plug and play simplicity. But now when I try to install it (after uploading directly to modules or as a zip file), I get a compile error: Look out… Compile Error: Cannot declare class MinifyPageRender, because the name is already in use (line 5 of site/modules/MinifyPageRender/MinifyPageRender.module) This is running ProcessWire 3.0.210 and the same thing happens with debug mode on or off. Any clue why this might happen?
  3. I wrote that last post on a Saturday and I needed to have the new site up and running on Monday, so I ended up just using .htaccess to separate traffic into en and pt subdirectories and PHP files to create the pages. Which works, but at some point I'd still like to figure out how to do this using Processwire. Additionally I realized that in some cases the page names were the same for the two languages, whereas in others they were not (e.g., map and mapa). So I would have needed to futz with that detail as well, which didn't seem insurmountable but was another example of "square peg != round hole." Since one of the main reasons that I wanted this site in PW was to allow others to make edits and it turns out that no one else has shown any interest in doing that, I'm putting this on the shelf for a while. Thanks very much for the suggestions and info!
  4. Interesting! I wasn't aware of the multisite option, and that might be a better option in my case. With the multilingual site that I'm testing now, I was imagining just having a separate home page template that pulls the correct language data depending upon the domain name and displays the appropriate content, but I'm starting to see how I'm forcing a square peg into a round hole. OTOH, do I even need a multisite installation, or could I just have a normal installation with both English and Portuguese pages? To switch languages, I could just have a field in each page to link to its counterpart (or I could also just do what the existing HTML sites that I'm assimilating do now: have a single link to the home page in the alternate language). The only glitches that I can think of at the moment would be that a) every page name/URL would need to be unique (not really an issue in my case), and b) search would return results from both languages unless I added a filter. And of course as you mention I'd need to find a way to have two home pages (one per domain name), but I imagine that I could do that with either a home page template that adapts (perhaps just by pulling data from another page for an alternate language) or an .htaccess trick (rewriting one of the home page URLs).
  5. I just got back to this and I figured out how to modify the language switcher to specify the appropriate domain name when clicked (see below). I haven't delved into how to remove the subdirectories in the URLs or how to set the language to Portuguese whenever the portuguese.org domain name is used. Kinda wondering if in my case it wouldn't be easier to just start over with a non-multilingual installation and just create separate English and Portuguese pages (perhaps with a field in each mapping to its counterpart in the other language). if($language->name == 'pt') $rootdomain='https://portuguese.org'; else $rootdomain='https://english.org'; $hreflang = $homepage->getLanguageValue($language, 'name'); echo "<a hreflang='$hreflang' href='$rootdomain$url'>$language->title</a></li>";
  6. Hey there. Thanks for your reply! I can see how that would be good advice for another project, but in this case it's not really an option. This site is for a major published report that is produced jointly by a US-based and a Brazilian organization. The content for each language is not really just the same thing translated, since it's written for very different audiences and although it's based on the same research and data and makes the same main points, it changes a lot in the two editing processes. For example, to the English-speaking audience we need to explain elements of Brazilian history, geography, government functions, etc., whereas the Brazilian audience doesn't need any of that context but might need more explanation on a US policy or company with which the English-speaking audience is very likely to be familiar. I'm always amazed by how much texts like this need to be completely rewritten when "translated" in order to make sense in an entirely different context. And in any case, this is the 5th annual report for which the US and Brazilian groups have been promoting it using these separate domain names (I'm trying to bring all of the past separate HTML sites plus this new one under one organized PW roof), so that horse has left the barn. But yes I can certainly imagine that for other projects your advice might be very helpful and timely! I actually looked at that example before I posted my question here, and it was helpful for me to get started and understand where and how I needed to approach this. But I couldn't quite adapt the methods in it to my specific situation, since I'm using different domains entirely (not subdomains) and I don't want to include the /en/ and /pt/ anywhere in the URL. Maybe .htaccess is actually a better way to approach this particular case?
  7. Hmm. I wish I could edit my post above because that loop is obviously flawed, but here is code I would think should work and doesn't: $rootdomain='english.org'; $hreflang='en'; if(strpos($config->httpHost, "portuguese") === 0) { // PT domain $rootdomain='portuguese.org'; $hreflang='pt'; $languages->setLanguage('pt'); }
  8. Howdy - I've read through a few forum posts and experimented a bit on my own, but I feel like I'm missing something obvious so I thought I'd ask a dumb question here. I am setting up a simple bilingual website (English and Portuguese) and I started with the multilingual site template and a server that allows for two domain names (I'll call them "english.org" and "portuguese.org") to function equivalently. The language switcher works as expected and pages show the correct values for each language, so there's no problem in the setup. But there are two additional things that I need to do and haven't yet figured out: I want to set the user language based on the domain name, so that anyone coming in via a portuguese.org link will see pages in Portuguese (including the home page) and otherwise it will default to English. I do not want to show /en/ or /pt/ in my URLs, since the domain names themselves are what is distinguishing between the two languages. I've tried things like this in a prepended file to set the language to Portuguese, but so far it hasn't worked as intended: $rootdomain='english.org'; $hreflang='en'; foreach($languages as $language) { if(strpos($config->httpHost, "portuguese") === 0) { // PT domain $rootdomain='portuguese.org'; $hreflang='pt'; $user->language = $language; break; } } What I hoped to get from this code was presetting the language to Portuguese based on the incoming domain name and from that I could include $rootdomain and $hreflang in the language switcher so that the domain name would change also when the switcher is used, but so far it hasn't worked. I also feel like I'm doing this wrong by looping through $languages since I only have two, but I tried this after other methods failed. Someone who is more familiar with this class can probably point out my error easily. And as for #2 (removing the language code from the URL), my first instinct is to do this using .htaccess (portuguese.org -> portuguese.org/pt/) but based on other forum posts I've seen that may not be necessary. What's the PW way to get these URLs? I assume that I must have unique (and not empty) slugs for both languages in every page for this to work without .htaccess, since both domain names resolve to the same place, right? Thanks in advance for your help with this!
×
×
  • Create New...