Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Make strings translatable? #23

Closed
Aetles opened this issue Apr 6, 2014 · 3 comments
Closed

Make strings translatable? #23

Aetles opened this issue Apr 6, 2014 · 3 comments

Comments

@Aetles
Copy link
Contributor

Aetles commented Apr 6, 2014

It would be nice if all English strings where encapsulated with the translation functions of WordPress.

Like __('Footer') instead of just 'Footer' in widgets and changing echo ' Archive | ' in header to something like echo ' ' . __('Archive') . ' | '.

@olefredrik
Copy link
Owner

Nice tip! I will look into this and include it in a future commit.

@Aetles
Copy link
Contributor Author

Aetles commented Apr 9, 2014

The above code is actually not a good example, I realize. Themes should use a text-domain, the Codex says:

If you're translating a plugin or a theme, you'll need to use a text domain to denote all text belonging to that plugin. This increases portability and plays better with already existing WordPress tools.

But my examples above worked for me as a lazy way of doing it since word like Footer and Sidebar already have translations in WordPress.

And as a final note, if the name of the widget areas are changed then they can't be called by name anymore so <?php dynamic_sidebar("Sidebar"); ?> has to change to <?php dynamic_sidebar( 'foundationpress_sidebar' ); ?>.

@PixelbarEupen
Copy link
Contributor

To echo a single translatable string, do not use echo __('Archive','FoundationPress');.
The correct way is to use _e('Archive','FoundationPress');

If the string is used within a echo function, you can use
echo ' ' . __('Archive','FoundationPress') . ' | ' without any problem :-)

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

3 participants