Development Log for arikado gridcoin pool #3

in #utopian-io6 years ago

Repository

https://github.com/sau412/arikado_gridcoin_pool

New Features

New feature is multiple language support for web-interface. Details:

  • Currently two languages supported: english and russian. And other languages could be added too.
  • Pool info block (dynamic section with news, instructions and details) also depends from current language.
  • Added new user role: editors. Editor is like ordinary user, but also can change pool info block.

Looking back I see what can be done better in project:

  • Text and messages was hardcoded in functions. Better solution could be receive text by code.
  • Similar blocks are coded in different functions. Implementation of multi-language support become more difficult.

Changes

Multiple languages support
  • Language library 'language.php' now has language-specific variables (commit)

Currently language data stored in one variable in json format. Like this:

"boinc_results_by_host_header":{
        "en":"BOINC results by host",
        "ru":"Результаты BOINC по хостам"
        },

And instead hardcoded text:

$result.="<h2>BOINC results by host</h2>\n";

Developer (me) should use new variant:

$result.=html_block_header_1("boinc_results_by_host_header");

Or at least

$result.="<h2>${current_language[boinc_results_by_host_header]}</h2>\n";

Where 'boinc_results_by_host_header' is variable from json, encoded in library.php.

  • Added change language handler to index.php (commit)

  • Pool info also should be language-specific (commit). Pool info in every language now edited independedly.

  • Replaced almost every bit of hardcoded text (commit)

Editor role

Editor is user that can edit pool info section. And 'Control' tab is visible for editor.

  • Admin can shoose 'editor' as user status in html.php (commit)
  • Function for checking user editor rights in boincmgr.php (commit)
  • Handler in index.php (commit)

Screenshots

Language selector

English language is default:

Current language selector in the upper right corner:

Page reloaded after click:

Editor role

Ordinary user menu:

User with role 'editor' can see 'Control' tab with pool info editor item inside:

Pool info editor is plain text editor, but can be replaced by WYSIWYG editor later:

How to contribute

I know russian (my native language) and english (upper intermediate level). If you know another languages (or can improve my english variant), you can contribute to project:

  • Volume: 131 variable with small bites of text and about 1000 english words in pool info.
  • Select code for your language. I think national domain is best variant.
  • Add translations to $lang_data_json variable (string 49) to lib/language.php (link)
  • Add pool info translation to pool_info_{code}.html file. You can translate it from russian (link) or english (link) variant.
  • Do pull request
  • I'll add other details if needed.

Links

Series backlinks

GitHub Account

https://github.com/sau412

Sort:  

Thanks for the contribution, @sau412! It's very cool to see you are adding support for multiple languages, as I know some people prefer using websites in their native language instead of English.

There are some minor inconsistencies in your code that could probably be solved by using a linter, but other than those it looks great - good work!


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @amosbastian! Keep up the good work!

Congratulations @sau412! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You received more than 1000 upvotes. Your next target is to reach 2000 upvotes.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

The Meet the Steemians Contest is over - Results are coming soon ...

Support SteemitBoard's project! Vote for its witness and get one more award!

Hey, @sau412!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Hi @sau412!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 58130.32
ETH 2361.48
USDT 1.00
SBD 2.38