Closed super3 closed 10 years ago
I was thinking we could implement the locale/language system by adding an extra top bar, just below or just above the current top bar with the page links.
The language links would be added via a foreach running through a variable like
$languages = array('en' => 'English', 'fr' => 'Français', 'es' => 'Español');
The languages array keys will be ISO 639-1 codes in order to keep everything standard.
Which creates anchor elements with the content of the array value, and links to a _GET parameter with the array key.
So for example, the Spanish locale link would look like so:
<a href='/?locale=es'>Español</a>
The href
would obviously point to the current page instead of redirecting back to the homepage. When clicked, or when the $_GET parameter "locale" is present, a cookie will be set to keep track of it.
If there is no cookie, use the first 2 characters from the HTTP Accept-Language
header.
Accept-Language: en-US
would default to "en" as the locale in the absence of a cookie declaring otherwise.
As for actually handling the locale text, we could have a class such as:
class Locale
{
function getText($text_key, $locale = 'en')
{
// Get the locale text translation for the provided $text_key id
}
}
There could be a default set up in the class's __construct()
call which checks for a cookie value of "locale".
The views would instead allocate "text_key" IDs to each part of text, such as:
$locale['en']['why_peercoin_title'] = "Why Peercoin?";
$locale['en']['why_peercoin_desc'] = "Through an innovative minting algorithm, the Peercoin network consumes far less energy, maintains stronger security, and rewards users in more sustainable ways than other cryptocurrencies.";
These locale text arrays could be stored as one big locale.php
file or in a directory named locales
as files named locale.es.php
for example.
Any locale text which does not exist for the provided language, such as the Spanish locale text array missing a translation which is used on the page, would be grabbed and displayed as English. That obviously isn't ideal, but hopefully that would never happen, and I think it'd be better than having no content.
I'm happy to get started on this system, but let me know if there's any issues or suggestions you have, as well as any questions you want cleared up.
Completely agree. Go for it. Would just want to apply this to the landing page for now though.
Just finished my implementation, I'll send a pull request for you to have a look at any minute now.
Well that was fast.
Two and a half hours of working have been sent for checking in Pull #242.
After my new years' hiatus I have finally returned. I agree that the site can be better organized than it currently is, even with the excellent changes that have been deployed in recent weeks.
What is the rationale for a single page layout? Esp one mimicking litecoin - their site is styled like it was built in 2002 hahahaha
It is not ment as a replacement but as a supplement. Basically a one stop shop if you just want to download the client. We can easily translate it to a few dozen languages, whereas maintaining a dozen different languages on a full site would be impossible. Look at bitcoin.org even they have pages missing for translation. But catering to other languages we close out our currency to everyone who doesn't speak English.
Theirs might be ugly, but there is no doubting that it works.
Ahhhh, yea single static page translated to various languages is an excellent idea as a suppliment. Makes porting the translations easier than the line by line prototype we have now as well.
Let's prioritize Spanish, Mandarin, Hindi, Indonesian, Japanese, Portugese German, Russian, and Arabic to maximize reach.
I was going to open a new issue requesting translations added to the strings.php
file, but I wanted to check a couple of things here first.
Which languages do you want added? Do you want as many as possible? Are there any priorities (the ones suggested by @iheartcryptocoin)?
Is the content going to be changing relatively soon with the new landing page?
If so, it'd obviously be a bit silly to get translations for the current content if it could be totally different soon anyway.
My next priority is to get the landing page finished, and have everyone agree on the 2 paragraphs or so to describe Peercoin. That actually might be a sperate repo, and the stick on the locale script. At that point its simply getting as many translations added to that as possible.
Of course our priorities are Spanish and Mandarin. Then its as many languages as we can get. On Feb 25, 2014 10:55 AM, "Dan Bartram" notifications@github.com wrote:
I was going to open a new issue requesting translations added to the strings.php file, but I wanted to check a couple of things here first. Languages
Which languages do you want added? Do you want as many as possible? Are there any priorities? Content
Is the content going to be changing relatively soon with the new landing page?
If so, it'd obviously be a bit silly to get translations for the current content if it could be totally different soon anyway.
Reply to this email directly or view it on GitHubhttps://github.com/super3/peercoin.net/issues/233#issuecomment-36022420 .
Seems to have merged into a discussion about translation. Closing for now.
Need to condense the http://peercoin.net into a single landing page. Should be slightly modeled after https://litecoin.org/ in terms of simplicity.
Should contain space in the header for links to multiple languages. Single click links to downloads for Windows, Linux, and Soucecode. Should also contain a 2 paragraph summary of the unique features of Peercoin.
Below this we can place links to various resources, exchanges, other parts of the website, etc.