Skip to content

Commit 68ff502

Browse files
committed
Add translation
1 parent 5a23c41 commit 68ff502

10 files changed

+200
-7
lines changed

accordion-block.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,18 @@ function pixelalbatross_accordion_block_init() {
3232
];
3333

3434
foreach ( $blocks as $block ) {
35-
$folder = sprintf( '%s/build/%s', __DIR__, $block );
36-
register_block_type( $folder );
35+
$folder = sprintf( '%s/build/%s', __DIR__, $block );
36+
$block_type = register_block_type( $folder );
37+
38+
if ( ! empty( $block_type->editor_script_handles ) ) {
39+
foreach ( $block_type->editor_script_handles as $handle ) {
40+
wp_set_script_translations(
41+
$handle,
42+
'accordion-block',
43+
plugin_dir_path( __FILE__ ) . 'languages'
44+
);
45+
}
46+
}
3747
}
3848
}
3949
add_action( 'init', 'pixelalbatross_accordion_block_init' );

build/accordion-item/block.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://schemas.wp.org/trunk/block.json",
3-
"apiVersion": 2,
3+
"apiVersion": 3,
44
"name": "pixelalbatross/accordion-item",
55
"title": "Accordion Item",
66
"category": "layout",

build/accordion/block.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://schemas.wp.org/trunk/block.json",
3-
"apiVersion": 2,
3+
"apiVersion": 3,
44
"name": "pixelalbatross/accordion",
55
"title": "Accordion",
66
"category": "layout",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"translation-revision-date":"2023-09-07 01:36+0100","generator":"WP-CLI\/2.8.1","source":"build\/accordion-item\/index.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"pt_PT","plural-forms":"nplurals=2; plural=(n != 1);"},"Accordion Title":["T\u00edtulo do acorde\u00e3o"],"Settings":["Configura\u00e7\u00f5es"],"Expand by default":["Expandir por omiss\u00e3o"],"When enabled, the item will be expanded by default on page load.":["Quando activado, o item ser\u00e1 expandido por omiss\u00e3o no carregamento da p\u00e1gina."]}}}

languages/accordion-block-pt_PT.mo

1.44 KB
Binary file not shown.

languages/accordion-block-pt_PT.po

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
msgid ""
2+
msgstr ""
3+
"Project-Id-Version: Accordion Block 0.3.0\n"
4+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/accordion-block\n"
5+
"POT-Creation-Date: 2023-09-07T00:21:35+00:00\n"
6+
"PO-Revision-Date: 2023-09-07 02:03+0100\n"
7+
"Last-Translator: \n"
8+
"Language-Team: \n"
9+
"Language: pt_PT\n"
10+
"MIME-Version: 1.0\n"
11+
"Content-Type: text/plain; charset=UTF-8\n"
12+
"Content-Transfer-Encoding: 8bit\n"
13+
"X-Generator: Poedit 3.3.2\n"
14+
"X-Domain: accordion-block\n"
15+
16+
#. Plugin Name of the plugin
17+
msgid "Accordion Block"
18+
msgstr "Bloco de Acordeão"
19+
20+
#. Plugin URI of the plugin
21+
msgid "https://pixelalbatross.pt/?utm_source=wp-plugins&utm_medium=accordion-block&utm_campaign=plugin-uri"
22+
msgstr ""
23+
24+
#. Description of the plugin
25+
msgid "Display content in collapsible sections."
26+
msgstr "Exibe conteúdo em secções recolhíveis."
27+
28+
#. Author of the plugin
29+
msgid "Pixel Albatross"
30+
msgstr ""
31+
32+
#. Author URI of the plugin
33+
msgid "https://pixelalbatross.pt/?utm_source=wp-plugins&utm_medium=accordion-block&utm_campaign=author-uri"
34+
msgstr ""
35+
36+
#. translators: %s accordion title
37+
#: build/accordion-item/render.php:20
38+
msgctxt "ARIA label when the accordion is closed"
39+
msgid "%s, show this section"
40+
msgstr "%s, mostrar esta secção"
41+
42+
#. translators: %s accordion title
43+
#: build/accordion-item/render.php:26
44+
msgctxt "ARIA label when the accordion is open"
45+
msgid "%s, hide this section"
46+
msgstr "%s, ocultar esta secção"
47+
48+
#: build/accordion-item/block.json
49+
msgctxt "block title"
50+
msgid "Accordion Item"
51+
msgstr "Item de acordeão"
52+
53+
#: build/accordion-item/block.json build/accordion/block.json
54+
msgctxt "block description"
55+
msgid "Display content in collapsible sections."
56+
msgstr "Apresentar conteúdo em secções recolhíveis."
57+
58+
#: build/accordion/block.json
59+
msgctxt "block title"
60+
msgid "Accordion"
61+
msgstr "Acordeão"
62+
63+
#: build/accordion/block.json
64+
msgctxt "block keyword"
65+
msgid "accordion"
66+
msgstr "acordeão"
67+
68+
#: build/accordion/block.json
69+
msgctxt "block keyword"
70+
msgid "collapse"
71+
msgstr "recolhível"
72+
73+
#: build/accordion-item/index.js:1
74+
msgid "Accordion Title"
75+
msgstr "Título do acordeão"
76+
77+
#: build/accordion-item/index.js:1
78+
msgid "Settings"
79+
msgstr "Configurações"
80+
81+
#: build/accordion-item/index.js:1
82+
msgid "Expand by default"
83+
msgstr "Expandir por omissão"
84+
85+
#: build/accordion-item/index.js:1
86+
msgid "When enabled, the item will be expanded by default on page load."
87+
msgstr "Quando activado, o item será expandido por omissão no carregamento da página."

languages/accordion-block.pot

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Copyright (C) 2023 Pixel Albatross
2+
# This file is distributed under the GPL-2.0-or-later.
3+
msgid ""
4+
msgstr ""
5+
"Project-Id-Version: Accordion Block 0.3.0\n"
6+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/accordion-block\n"
7+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8+
"Language-Team: LANGUAGE <LL@li.org>\n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"POT-Creation-Date: 2023-09-07T00:57:15+00:00\n"
13+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14+
"X-Generator: WP-CLI 2.8.1\n"
15+
"X-Domain: accordion-block\n"
16+
17+
#. Plugin Name of the plugin
18+
msgid "Accordion Block"
19+
msgstr ""
20+
21+
#. Plugin URI of the plugin
22+
msgid "https://pixelalbatross.pt/?utm_source=wp-plugins&utm_medium=accordion-block&utm_campaign=plugin-uri"
23+
msgstr ""
24+
25+
#. Description of the plugin
26+
msgid "Display content in collapsible sections."
27+
msgstr ""
28+
29+
#. Author of the plugin
30+
msgid "Pixel Albatross"
31+
msgstr ""
32+
33+
#. Author URI of the plugin
34+
msgid "https://pixelalbatross.pt/?utm_source=wp-plugins&utm_medium=accordion-block&utm_campaign=author-uri"
35+
msgstr ""
36+
37+
#. translators: %s accordion title
38+
#: build/accordion-item/render.php:20
39+
msgctxt "ARIA label when the accordion is closed"
40+
msgid "%s, show this section"
41+
msgstr ""
42+
43+
#. translators: %s accordion title
44+
#: build/accordion-item/render.php:26
45+
msgctxt "ARIA label when the accordion is open"
46+
msgid "%s, hide this section"
47+
msgstr ""
48+
49+
#: build/accordion-item/index.js:1
50+
msgid "Accordion Title"
51+
msgstr ""
52+
53+
#: build/accordion-item/index.js:1
54+
msgid "Settings"
55+
msgstr ""
56+
57+
#: build/accordion-item/index.js:1
58+
msgid "Expand by default"
59+
msgstr ""
60+
61+
#: build/accordion-item/index.js:1
62+
msgid "When enabled, the item will be expanded by default on page load."
63+
msgstr ""
64+
65+
#: build/accordion-item/block.json
66+
msgctxt "block title"
67+
msgid "Accordion Item"
68+
msgstr ""
69+
70+
#: build/accordion-item/block.json
71+
#: build/accordion/block.json
72+
msgctxt "block description"
73+
msgid "Display content in collapsible sections."
74+
msgstr ""
75+
76+
#: build/accordion/block.json
77+
msgctxt "block title"
78+
msgid "Accordion"
79+
msgstr ""
80+
81+
#: build/accordion/block.json
82+
msgctxt "block keyword"
83+
msgid "accordion"
84+
msgstr ""
85+
86+
#: build/accordion/block.json
87+
msgctxt "block keyword"
88+
msgid "collapse"
89+
msgstr ""

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@
2727
"lint:js": "wp-scripts lint-js",
2828
"packages-update": "wp-scripts packages-update",
2929
"plugin-zip": "wp-scripts plugin-zip",
30-
"start": "wp-scripts start"
30+
"start": "wp-scripts start",
31+
"translate": "npm run translate:pot && npm run translate:update",
32+
"translate:pot": "wp i18n make-pot . languages/accordion-block.pot --exclude=src",
33+
"translate:update": "wp i18n update-po languages/accordion-block.pot languages/*.po",
34+
"translate:compile": "npm run translate:mo && npm run translate:js",
35+
"translate:js": "wp i18n make-json languages --no-purge",
36+
"translate:mo": "wp i18n make-mo languages languages"
3137
},
3238
"devDependencies": {
3339
"@wordpress/scripts": "^26.0.0",

src/accordion-item/block.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://schemas.wp.org/trunk/block.json",
3-
"apiVersion": 2,
3+
"apiVersion": 3,
44
"name": "pixelalbatross/accordion-item",
55
"title": "Accordion Item",
66
"category": "layout",

src/accordion/block.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://schemas.wp.org/trunk/block.json",
3-
"apiVersion": 2,
3+
"apiVersion": 3,
44
"name": "pixelalbatross/accordion",
55
"title": "Accordion",
66
"category": "layout",

0 commit comments

Comments
 (0)