unclecheese / langeditor Goto Github PK
View Code? Open in Web Editor NEWLang Editor module for SilverStripe CMS
Lang Editor module for SilverStripe CMS
This module looks awesome as hell. It just seems weird that when you copy a lang file to a new language, it ends up in that selected module, and therefore would be deleted when the project is installed somewhere else, because the modules are repo's.
Are you supposed to exclude all modules from the list and then created a lang file in mysite for everything, which users can then copy?
Hi @unclecheese
I'm using your LangEditor for my Silverstripe Project. I have several Languages available on my site, also Portuguese-Portugal (pt_PT) and Portuguese-Brazil (pt_BR)
Problem is, that i18n.php->common_languages array does not have the language key pt itself - instead it supports pt_PT and pt_BR. So it's not possible to select these two Languages in your LangEditor in CMS
quick fix for me was, that I added an if for the case of pt_PT and pt_BR in Methods getLanguages()
if (! in_array($label, static::config()->exclude_locales)) {
$name = i18n::get_language_name(self::get_lang_from_locale($label));
//add: due to lang-key 'pt' is not available in i18n->common_languages, use pt_BR and pt_PT as lang-key instead
if($label == 'pt_BR' || $label == 'pt_PT') {
$name = i18n::get_language_name($label);
}
$langs->push(new ArrayData([
'Link' => Director::baseURL().'admin/'.static::config()->url_segment.'/show/'.$label.'/'.str_replace(DIRECTORY_SEPARATOR, '$', static::config()->currentModule),
'Locale' => $label,
'Name' => $name,
'Current' => $label == static::config()->currentLocale ? true : false,
]));
}
and CreateTranslationForm()
if (! in_array($locale, static::config()->exclude_locales)) {
$language = self::get_lang_from_locale($locale);
//add: check if locale is pt_PT or pt_BR and set language due to i18n common_language-array does not support pt (just pt_PT and pt_BR)
if($locale == 'pt_PT' || $locale == 'pt_BR') {
$language = $locale;
}
$to_languages[$language] = $common_languages[$language];
}
Please have a look on this bug.
Greetings Magdalena
Hi,
I found a small bug in LangEditor.php file, line 167:
$str = $str[0];
Should be for instant:
$str = reset($str);
Could you fix it?
i see the composer silverstripe/langeditor package not existing at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.