Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Update make-pot command (translations) #95

Merged
merged 8 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion wordpress/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"10up/wp_mock": "0.4.2"
},
"scripts": {
"post-install-cmd": "cd wp-content/themes/cds-default && composer install"
"post-install-cmd": "cd wp-content/themes/cds-default && composer install",
"make-pot": "wp i18n make-pot --domain=cds-snc wp-content/themes/cds-default wp-content/themes/cds-default/languages/cds-snc.pot"
}
}
34 changes: 15 additions & 19 deletions wordpress/wp-content/themes/cds-default/404.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@

<section class="error-404 not-found">
<header class="page-header">
<h1 class="page-title"><?php esc_html_e('Oops! That page can&rsquo;t be found.', 'cds'); ?></h1>
<h1 class="page-title"><?php esc_html_e(
'Page not found.',
'cds-snc',
); ?></h1>
</header><!-- .page-header -->

<div class="page-content">
<p><?php esc_html_e('It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'cds'); ?></p>
<p><?php esc_html_e(
'It looks like nothing was found at this location. Maybe try one of the links below or a search?',
'cds-snc',
); ?></p>

<?php
get_search_form();
Expand All @@ -30,34 +36,24 @@
?>

<div class="widget widget_categories">
<h2 class="widget-title"><?php esc_html_e('Most Used Categories', 'cds'); ?></h2>
<h2 class="widget-title"><?php esc_html_e(
'Most Used Categories',
'cds-snc',
); ?></h2>
<ul>
<?php
wp_list_categories(
[
<?php wp_list_categories([
'orderby' => 'count',
'order' => 'DESC',
'show_count' => 1,
'title_li' => '',
'number' => 10,
]
);
?>
]); ?>
</ul>
</div><!-- .widget -->

<?php
/* translators: %1$s: smiley */
$cds_archive_content = '<p>' . sprintf(esc_html__('Try looking in the monthly archives. %1$s', 'cds'), convert_smilies(':)')) . '</p>';
the_widget('WP_Widget_Archives', 'dropdown=1', "after_title=</h2>${cds_archive_content}");

the_widget('WP_Widget_Tag_Cloud');
?>

</div><!-- .page-content -->
</section><!-- .error-404 -->

</main><!-- #main -->

<?php
get_footer();
<?php get_footer();
2 changes: 1 addition & 1 deletion wordpress/wp-content/themes/cds-default/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"lint:wpcs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
"lint:php": "@php ./vendor/bin/parallel-lint --exclude .git --exclude vendor .",
"make-pot": "wp i18n make-pot . languages/_s.pot"
"make-pot": "wp i18n make-pot --domain=cds-snc . languages/cds-snc.pot"
},
"support": {
"issues": "https://github.com/Automattic/_s/issues",
Expand Down
58 changes: 35 additions & 23 deletions wordpress/wp-content/themes/cds-default/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';
require_once __DIR__. '/inc/template-functions.php';
require_once __DIR__.'/inc/template-filters.php';
require_once __DIR__ . '/inc/template-functions.php';
require_once __DIR__ . '/inc/template-filters.php';

/**
* cds-default functions and definitions
Expand All @@ -14,28 +14,44 @@
* @package cds-default
*/

if (! defined('_S_VERSION')) {
if (!defined('_S_VERSION')) {
// Replace the version number of the theme on each release.
define('_S_VERSION', '1.0.0');
}

if (! function_exists('cds_setup')) {
if (!defined('THEME_NAMESPACE')) {
// Replace the version number of the theme on each release.
define('THEME_NAMESPACE', 'cds-snc');
}

if (!function_exists('cds_setup')) {
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function load_translations()
{
$domain = 'cds-snc';
$locale = apply_filters('theme_locale', determine_locale(), $domain);
$mo = $domain . '-' . $locale . '.mo';
load_textdomain(
$domain,
get_template_directory() . '/languages/' . $mo,
);
}

function cds_setup(): void
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on cds-default, use a find and replace
* to change 'cds' to the name of your theme in all the template files.
* to change 'cds-snc' to the name of your theme in all the template files.
*/
load_theme_textdomain('cds', get_template_directory() . '/languages');
load_translations();

// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
Expand All @@ -56,28 +72,23 @@ function cds_setup(): void
add_theme_support('post-thumbnails');

// This theme uses wp_nav_menu() in one location.
register_nav_menus(
[
'menu-1' => esc_html__('Primary', 'cds'),
]
);
register_nav_menus([
'menu-1' => esc_html__('Primary', 'cds-snc'),
]);

/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
[
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
]
);
add_theme_support('html5', [
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
]);
}
}
add_action('after_setup_theme', 'cds_setup');
Expand All @@ -89,6 +100,7 @@ function cds_scripts(): void
{
wp_enqueue_style('cds-style', get_stylesheet_uri(), [], _S_VERSION);
}

add_action('wp_enqueue_scripts', 'cds_scripts');

/**
Expand Down
14 changes: 7 additions & 7 deletions wordpress/wp-content/themes/cds-default/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<body <?php body_class(); ?> vocab="http://schema.org/" resource="#wb-webpage" typeof="WebPage">
<?php wp_body_open(); ?>

<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e('Skip to content', 'cds'); ?></a>
<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e('Skip to content', 'cds-snc'); ?></a>
<header>
<div id="wb-bnr" class="container">
<div class="row">
Expand Down Expand Up @@ -69,21 +69,21 @@
<link property="logo" href="https://canada.ca/etc/designs/canada/wet-boew/assets/wmms-blk.svg">
</div>
<section id="wb-srch" class="col-lg-offset-4 col-md-offset-4 col-sm-offset-2 col-xs-12 col-sm-5 col-md-4">
<h2><?php _e('Search', 'cds'); ?></h2>
<h2><?php _e('Search', 'cds-snc'); ?></h2>
<form action="/<?php echo $langText['abbr']; ?>/sr/srb.html" method="post" name="cse-search-box"
role="search">
<div class="form-group wb-srch-qry">
<label for="wb-srch-q" class="wb-inv"><?php _e('Search Canada.ca', 'cds') ?></label>
<label for="wb-srch-q" class="wb-inv"><?php _e('Search Canada.ca', 'cds-snc') ?></label>
<input id="wb-srch-q" list="wb-srch-q-ac" class="wb-srch-q form-control" name="q" type="search"
value="" size="34" maxlength="170" placeholder="<?php _e('Search Canada.ca', 'cds') ?>">
value="" size="34" maxlength="170" placeholder="<?php _e('Search Canada.ca', 'cds-snc') ?>">
<datalist id="wb-srch-q-ac">
</datalist>
</div>
<div class="form-group submit">
<button type="submit" id="wb-srch-sub" class="btn btn-primary btn-small" name="wb-srch-sub">
<span class="glyphicon-search glyphicon"></span><span class="wb-inv"><?php _e(
'Search',
'cds'
'cds-snc'
); ?></span></button>
</div>
</form>
Expand All @@ -92,9 +92,9 @@
</div>
<nav class="gcweb-menu" typeof="SiteNavigationElement">
<div class="container">
<h2 class="wb-inv"><?php _e('Menu', 'cds'); ?></h2>
<h2 class="wb-inv"><?php _e('Menu', 'cds-snc'); ?></h2>
<button type="button" aria-haspopup="true" aria-expanded="false"><span
class="wb-inv"><?php _e('Main', 'cds'); ?> </span><?php _e('Menu', 'cds'); ?> <span
class="wb-inv"><?php _e('Main', 'cds-snc'); ?> </span><?php _e('Menu', 'cds-snc'); ?> <span
class="expicon glyphicon glyphicon-chevron-down"></span></button>
<ul role="menu" aria-orientation="vertical">
<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ function cds_prev_next_links(): void
$next_permalink = get_permalink($next_id); ?>

<nav class="mrgn-tp-xl">
<h2 class="wb-inv"> <?php _e('Document navigation', 'cds'); ?> </h2>
<h2 class="wb-inv"> <?php _e('Document navigation', 'cds-snc'); ?> </h2>
<ul class="pager">
<li class="next">
<a id="<?php echo $prev_id ?>" href="<?php echo $next_permalink; ?>"><?php _e(
'Next blog post',
'cds'
'cds-snc'
); ?> &nbsp;»</a>
</li>
<li class="previous">
<a id="<?php echo $next_id ?>" href="<?php echo $prev_permalink; ?>"
rel="prev">«&nbsp;<?php _e('Previous blog post', 'cds'); ?></a>
rel="prev">«&nbsp;<?php _e('Previous blog post', 'cds-snc'); ?></a>
</li>
</ul>
</nav>
Expand Down
6 changes: 3 additions & 3 deletions wordpress/wp-content/themes/cds-default/inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function cds_posted_by(): void
{
$byline = sprintf(
/* translators: %s: post author. */
esc_html_x('by %s', 'post author', 'cds'),
esc_html_x('by %s', 'post author', 'cds-snc'),
'<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>'
);

Expand All @@ -61,15 +61,15 @@ function cds_entry_footer(): void
if (get_post_type() === 'post') {
$pId = get_the_ID();
/* translators: used between list items, there is a space after the comma */
// $categories_list = get_the_category_list(esc_html__(', ', 'cds'));
// $categories_list = get_the_category_list(esc_html__(', ', 'cds-snc'));
echo "<ul class='list-inline'>".cds_category_links($pId).'</ul>';
}

// edit_post_link(
// sprintf(
// wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
// __('Edit <span class="screen-reader-text">%s</span>', 'cds'),
// __('Edit <span class="screen-reader-text">%s</span>', 'cds-snc'),
// [
// 'span' => [
// 'class' => [],
Expand Down
Binary file not shown.
110 changes: 110 additions & 0 deletions wordpress/wp-content/themes/cds-default/languages/cds-snc-fr_FR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-24T13:13:33+00:00\n"
"PO-Revision-Date: 2021-08-24 09:18-0400\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.0\n"
"X-Domain: cds-snc\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#: 404.php:20
msgid "Page not found."
msgstr ""

#: 404.php:27
msgid ""
"It looks like nothing was found at this location. Maybe try one of the links "
"below or a search?"
msgstr ""

#: 404.php:39
msgid "Most Used Categories"
msgstr ""

#: functions.php:76
msgid "Primary"
msgstr ""

#: header.php:40
msgid "Skip to content"
msgstr ""

#: header.php:72 header.php:84
msgid "Search"
msgstr "Recherche"

#: header.php:76 header.php:78
msgid "Search Canada.ca"
msgstr "Rechercher dans Canada.ca"

#: header.php:95 header.php:97
msgid "Menu"
msgstr ""

#: header.php:97
msgid "Main"
msgstr ""

#: inc/template-functions.php:23
msgid "Document navigation"
msgstr ""

#: inc/template-functions.php:26
msgid "Next blog post"
msgstr ""

#: inc/template-functions.php:33
msgid "Previous blog post"
msgstr ""

#. translators: %s: post author.
#: inc/template-tags.php:46
msgctxt "post author"
msgid "by %s"
msgstr ""

#. translators: %s: search query.
#: search.php:24
msgid "Search Results for: %s"
msgstr ""

#: template-parts/content-none.php:17
msgid "Nothing Found"
msgstr ""

#. translators: 1: link to WP admin new post page.
#: template-parts/content-none.php:26
msgid ""
"Ready to publish your first post? <a href=\"%1$s\">Get started here</a>."
msgstr ""

#: template-parts/content-none.php:38
msgid ""
"Sorry, but nothing matched your search terms. Please try again with some "
"different keywords."
msgstr ""

#: template-parts/content-none.php:44
msgid "Nothing found! Perhaps searching can help."
msgstr ""

#: template-parts/content-page.php:26
msgid "Pages:"
msgstr ""

#. translators: %s: Name of current post. Only visible to screen readers
#: template-parts/content-page.php:40
msgid "Edit <span class=\"screen-reader-text\">%s</span>"
msgstr ""

#. translators: %s: Name of current post. Only visible to screen readers
#: template-parts/content.php:35
msgid "Continue reading<span class=\"screen-reader-text\"> \"%s\"</span>"
msgstr ""
Loading