pressupinc / wphierarchy

WordPress template hierarchy resource
Other
120 stars 45 forks source link

Add i18n #16

Open ramiabraham opened 9 years ago

ramiabraham commented 9 years ago

Starting with Japanese translation noted in #10.

davidbhayes commented 7 years ago

I think it would be great if the site could be provided in many different languages, but I'm unsure how to handle it. What things need to be translated for non-English speakers to fully understand the guide? What would be the best mechanism for us to support the creation and access of such alternates?

atachibana commented 7 years ago

In version 1, I created the following page (Yes, I need update ASAP!) https://unofficialtokyo.com/wordpress-template-hierarchy/

Translated strings were hard coded:

If possible, we can follow I18N of WordPress https://codex.wordpress.org/I18n_for_WordPress_Developers

I will try it though don't have any experience ...

davidbhayes commented 7 years ago

@atachibana So basically everything other than filenames would be translated...? That makes sense. I'll have to think harder about how WordPress i18n stuff could be used, as the site itself isn't using WordPress.

Also, am I understanding correctly that you think it'd be better if we had changed the underlying link to new resources? I'll also have to think about how that'll work. Currently those are fetched from the "API", so that adds a different level of complexity. You are saying that would be helpful, right?

atachibana commented 7 years ago

@davidbhayes

So basically everything other than filenames would be translated...?

Yes, it should be so. As a first step, if you can separate the string into JSON file or some arrays, then easier for I18N.

Also, am I understanding correctly that you think it'd be better if we had changed the underlying link to new resources?

Yes, it is better. But it is low priority because 1) Not so many languages do not have own documents. Japanese is one exception. 2) The linked documents have language pointer. For example, refer header square box in https://codex.wordpress.org/Author_Templates. You'll see the list of language link if it exists.

Especially, when you have technical difficulties, you don't need implement this function, I think.

davidbhayes commented 7 years ago

@atachibana Thanks for clarifying, that all makes sense. 👍

davidbhayes commented 7 years ago

A separate question that I think is important on this issue is how you'd switch to translations. I think for self-hosting translations, overwriting manually is OK, but hard to maintain. But self-hosted alternatives clearly wouldn't let us switch live for visitors on the site.

But if we had on the main site a language toggle I'm not sure how it would ideally work? A banner of options which put a query string in the URL (like wphierarchy.com/?lang=es_ES)? That's easy, but not the most elegant...

atachibana commented 7 years ago

Hi David

Query string is not so bad idea. At least, for non English user, that switch is one common idea. Another simple solution is putting a link to I18N version.

By the way, I have one request to your web site from a view of I18N.

Please give us History of Changes of your diagram. For example

Translator can easily update their own Template Images (Note: It might be static JPG file with translated text). This revision log must be useful for even English user.

davidbhayes commented 7 years ago

Opened a new issue (#32, https://github.com/pressupinc/wphierarchy/issues/32) about the changelog request. That makes lots of sense but I think is better as a separate issue.

I'll keep the query string vs links options in mind as I think more about this. Thanks @atachibana