Coder Social home page Coder Social logo

langeditor's People

Contributors

doniz avatar jelicanin avatar sn4h avatar striky1 avatar xini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

langeditor's Issues

Bug for language Portuguese

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

Function to move file from module to mysite?

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?

[Notice] Undefined offset: 0

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.