Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
/**
* Gets xmlsitemap frequency options.
*
* @return array
* Frequency options.
*
* @todo Document this function.
* @todo Make these translatable
*/
function xmlsitemap_get_changefreq_options() {
return array(
XMLSITEMAP_FREQUENCY_ALWAYS => 'always',
XMLSITEMAP_FREQUENCY_HOURLY => 'hourly',
XMLSITEMAP_FREQUENCY_DAILY => 'daily',
XMLSITEMAP_FREQUENCY_WEEKLY => 'weekly',
XMLSITEMAP_FREQUENCY_MONTHLY => 'monthly',
XMLSITEMAP_FREQUENCY_YEARLY => 'yearly',
);
}
Comment | File | Size | Author |
---|---|---|---|
#21 | 2850367-fix-changefreq-untranslated-default.patch | 2.12 KB | Dave Reid |
| |||
#4 | xmlsitemap_change_frequency_translatable-2850367-4.patch | 1.13 KB | mrinalini9 |
#2 | xmlsitemap_change_frequency_translatable-2850367-2.patch | 1.23 KB | Cyberwolf |
Issue fork xmlsitemap-2850367
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
Cyberwolf CreditAttribution: Cyberwolf at 2DotsTwice bvba commentedComment #3
Dave ReidComment #4
mrinalini9 CreditAttribution: mrinalini9 at Srijan | A Material+ Company for Drupal India Association commentedRerolled patch #2 as it failed to apply, please review.
Comment #8
Zenovii_Kholyavka CreditAttribution: Zenovii_Kholyavka at EPAM Systems commentedI fixed test related translations and added changes which was added by @mrinalini9. Please review.
Comment #9
Andrii Kleba CreditAttribution: Andrii Kleba at EPAM Systems commented@Zenovii_Kholyvka works as expected, thanks
Comment #10
renatogI've checked and it really works well. Thank you so much
Comment #12
renatogMoved to the dev branch.
Thank you so much for your contribution
Comment #14
Dave ReidWhy did these translations need context on them? Each word is pretty generic, I wouldn't think it would be necessary.
Comment #15
Dave ReidFollowing on https://www.drupal.org/docs/7/api/localization-api/string-context I don't see why the context is necessary. Maybe "always" but even then I'm doubtful.
Comment #16
Dave ReidI removed the contexts for most of these and updated the context for "always" to "At all times" and for "never" to "At no time" (also never was missing translation). Also the sitemap generation needs an untranslated string at all times, so I needed to add a parameter to return the raw string value instead of the translated string.
Comment #17
lonaloreI downgraded the module back to v1.2 on my websites because Google invalidated all URLs due to (bad hungarian?) translation. Please add a context to all of the changefreq translations, or please provide an option to disable translation.
Comment #18
Dave Reid@lonalore You're not on the latest release, this was fixed in the 1.3 release.
Comment #19
lonaloreI upgraded the module to v1.3 again, and I get invalid sitemap.xml now.
Module:
Generated sitemap:
https://www.erettsegitetel.hu/sitemap.xml
As I see it, the bug may be that the xmlsitemap_get_changefreq() function is called with 1 parameter everywhere, and the second parameter is TRUE by default, so changefreq is translated in all cases.
Comment #20
lonaloreGoogle Search Console says that all links are invalid due to the changefreq.
Comment #21
Dave ReidYup you're right, I shouldn't have changed the default option for xmlsitemap_get_changefreq_options() to return the translated string by default, it should return the untranslated string by default. Patch fixes the issue and has test coverage.
Comment #22
Dave ReidComment #24
Dave ReidCommitted #21 to 8.x-1.x and will release today or tomorrow.