Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

i18n: Add support for Text Domains #23

Closed
grappler opened this issue Jan 29, 2018 · 4 comments
Closed

i18n: Add support for Text Domains #23

grappler opened this issue Jan 29, 2018 · 4 comments
Assignees

Comments

@grappler
Copy link

The strings in the internationalization functions of block.js need to have a text domain. e.g __( 'CGB Example' ).

The plugin slug can be easily used for this.

@ahmadawais
Copy link
Owner

@grappler Thanks for dropping by. Would love to see you contribute to this project.

I don't think so that the __() function can take another argument. That's not how it's implemented.

 export function __( text ) { 
 	return getI18n().gettext( text ); 
 } 

https://github.com/WordPress/gutenberg/blob/f36477830b15762755fc06a55359fd8d952776ca/i18n/index.js#L33-L44

But I am open to suggestions here. I think we can ask @ntwb about this. 🤔

@grappler
Copy link
Author

It seems you are right. In the i18n readme there is:

Note that you will not need to specify domain for the strings.

It seems like there is an issue that there is no place to define the textdomain yet WordPress/gutenberg#4147.

The reason that I thought there was a text domain there was that the few code examples that I saw added the text domain.

I think there was some confusion also with the JS i18n features discussed for core. https://make.wordpress.org/core/2016/10/10/javascript-internationalization/

@ahmadawais
Copy link
Owner

We can work on generating a .pot file but this one seems to be addressed. I hope you'll contribute.

@grappler
Copy link
Author

grappler commented Apr 4, 2018

We might need to reopen this as custom Text Domain support has been added in WordPress/gutenberg#5235

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants