Open OpenA opened 9 years ago
I think this is a step in the right direction for internationalization of CyTube. For version 4.0 I've been toying with the idea of adding internationalization for server-generated informational/error messages. The main barrier to this is finding trustworthy multilingual people to translate.
I have a couple of points to make about your proposed change:
lacss-
prefix to something a little more clear in meaning. One idea is to use i18n-
since "i18n" is a universally recognized shorthand for internationalization.lang
attribute based on the Accept-Language
header sent by the browser? This is not something I would expect you to do before submitting a pull request, but I'd like to know what you think of it./My bad english is very bad, sorry есличо
No problem, you got the point across ;)
The lang attribute is supported by all main browsers.
I was referring to the CSS :before and :after rules, not the lang attribute
On Nov 18, 2014, at 13:13, Erik Little notifications@github.com wrote:
The lang attribute is supported by all main browsers.
— Reply to this email directly or view it on GitHub.
Another idea for the prefix name would be lc
(easier to type, stands for locale).
Another idea for the prefix name would be lc (easier to type, stands for locale).
i18n
look's better in the code i think, but anyway it's your deal
:before
and :after
pseudo elements supports all browsers -
What would you think about altering the template to dynamically set the lang attribute based on the Accept-Language header sent by the browser? This is not something I would expect you to do before submitting a pull request, but I'd like to know what you think of it.
it's need send information to the server? i dont know, but maybe better just using navigator.language ? something like this:
function getlSValue(name, def, sess) {
var stor = sess ? sessionStorage : localStorage;
if (name in stor) {
var v = stor.getItem(name);
v = v == 'false' ? false :
v == 'true' ? true : v;
return v;
} else {
stor.setItem(name, def);
return def;
}
}
function setLocale(e) {
var val = e.target.value;
localStorage.setItem('i18n', val);
document.documentElement.lang = val;
}
var navLang = navigator.language.split('-')[0]
document.documentElement.lang = getlSValue('i18n', navLang)
If user visit site in the first time, locales getting from the navigator.language (browser lang). If user needs to change locale, he can choose locale from the options:
//(i don't know why, but onchenge event not working without name attribute)
<select id="us-locale" name="i18n" onchenge="setLocale(event)">
<option value="en">English</option>
<option value="ru">Русский</option>
</select>
Just to follow up on this, I've started looking at localization for CyTube 4.0 (the next major release which will be a complete rewrite-- no ETA at this time), and I've decided to go with the i18n module rather than CSS-based localization.
__("Channel")
in the template using the new method vs. th.i18n-channel
using CSS)@calzoneman I can somehow help? maybe it's time to do the replacement text on templates, and localization in the json file?
Actually I have not worked on this at all since the last comment. The previously mentioned CyTube 4.0 is a defunct project -- I decided to focus on making incremental improvements to 3.x instead. Localizing CyTube is a nontrivial project and I've been focusing my time on other features of CyTube. If there is sufficient interest in getting it implemented soon, it would be best if someone could familiarize themselves with the codebase and I'd be happy to give some guidance and walk them through implementing this.
Many forks are done just only for replace english words.
CyTube using jade replаcements for customize #{brandName} / #{pageTitle} but i think it's bad idea use this for locals change, and i think css implementation is better (for locals):
Result:
but specific attributes doesnt work for table's elements [h1 tr td th])
If I finish migrate, do you accept this implementation? /My bad english is very bad, sorry есличо