Add More Genders Download 2.0

Indonesian Arsalan Shah 4 years ago

A simple component to add more genders. This will add a 3rd gender called others. You may add more genders in array by editing a file components/MoreGenders/ossn_com.php For example in case you wanted to add 4th Gender

 'options' => array(
 'male' => ossn_print('male'),
 'female' => ossn_print('female'),
 'other' => 'Other', 
 'fourth_gender' => '4th Gender',
 )

.

Comments
German Dominik L Replied 2 weeks ago

i will try, thanks

Indonesian Arsalan Shah Replied 2 weeks ago

All translations strings need to be done via ossn_print()

You need to add translations in each file example ossn.de.php
https://github.com/opensource-socialnetwork/opensource-socialnetwork/blob/master/locale/ossn.de.php#LL40C1-L41C28

Example ossn.de.php for

  ossn_register_languages('de', array(
        'male' => 'männlich',
        'female' => 'weiblich',
         'other' => 'Other',
        ' fourthgender' => 'Forth Translation',
 ));

I mentioend this in my previous reply too, ossn.en.php

ossn_register_languages('en', array(
        'weiblich' => 'Something',
        'nonbinary' => 'Translation',
        'other' => 'Other',
        'unsure' => 'Unsure',                                   
));
German Dominik L Replied 2 weeks ago

How exactly do i have to do it?

how is the ossn_print recognizing the langauge selected by user?

Indonesian Arsalan Shah Replied 2 weeks ago

This component already support translation

'options' => array(
 'male' => ossn_print('male'),
 'female' => ossn_print('female'),
 'other' => ossn_print('other') 
 'fourth_gender' => ossn_print('fourthgender')
 )
German Dominik L Replied 2 weeks ago

I need help to implement locale file for translation

German Dominik L Replied 2 months ago

So you’ll fix the extended member component?

Or do I just have to add you code to the locale file from extended member?

Indonesian Arsalan Shah Replied 2 months ago

You need to add translation for values, problem doesn't relates to this component but the Extended member using values for translation.

ossn_register_languages('en', array(
        'weiblich' => 'Something',
        'nonbinary' => 'Translation',
        'other' => 'Other',
        'unsure' => 'Unsure',                                   
));
German Dominik L Replied 2 months ago

on profile it is working

enter image description here

but not with "site members"

enter image description here

<?php
/**
 * Open Source Social Network
 *
 * @package   (softlab24.com).ossn
 * @author    OSSN Core Team <[email protected]>
 * @copyright (C) SOFTLAB24 LIMITED
 * @license   Open Source Social Network License (OSSN LICENSE)  http://www.opensource-socialnetwork.org/licence
 * @link      https://www.opensource-socialnetwork.org/
 */
function new_gender_init() {
        ossn_add_hook('user', 'default:fields', 'new_gender');
}
function new_gender($hook, $type, $fields) {
        $toremove           = array(
                'gender'
        );
        $return             = ossn_remove_field_from_fields($toremove, $fields);
        $return['required']['radio'][] =  array(
                                'name' => 'gender',
                                'options' => array(
                                        'male' => ('Mann'),
                                        'female' => ('Frau'),
                                        'Non-binary' => 'Nicht-binär',
                                        'Trans (FTM)' => 'Trans (FTM)',
                                        'Trans (MTF)' => 'Trans (MTF)',
                                        'other' => 'Sonstige',
                                        'unsure' => 'Unsicher',
                                )
        );
        return $return;
}
ossn_register_callback('ossn', 'init', 'new_gender_init', 1000);
Indonesian Arsalan Shah Replied 2 months ago

post your code here

German Dominik L Replied 2 months ago

in english it is working:

enter image description here

but not in German:

enter image description here

Component

Developer: Arsalan
License ossnv3
Type: Uncategorized
Requires Ossn Version : 5.0
Latest Version: 2.0
Last Updated 4 years ago
Repository Url View Repository

Versions